plumber: fix memory leaks
parent
105ebc327a
commit
83b56186e4
|
@ -122,6 +122,7 @@ emalloc(long n)
|
|||
p = malloc(n);
|
||||
if(p == nil)
|
||||
error("malloc failed: %r");
|
||||
setmalloctag(p, getcallerpc(&n));
|
||||
memset(p, 0, n);
|
||||
return p;
|
||||
}
|
||||
|
@ -132,6 +133,7 @@ erealloc(void *p, long n)
|
|||
p = realloc(p, n);
|
||||
if(p == nil)
|
||||
error("realloc failed: %r");
|
||||
setrealloctag(p, getcallerpc(&p));
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -143,5 +145,6 @@ estrdup(char *s)
|
|||
t = strdup(s);
|
||||
if(t == nil)
|
||||
error("estrdup failed: %r");
|
||||
setmalloctag(t, getcallerpc(&s));
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ popinput(void)
|
|||
Bterm(in->fd);
|
||||
free(in->fd);
|
||||
}
|
||||
free(in->file);
|
||||
free(in);
|
||||
return 1;
|
||||
}
|
||||
|
@ -572,6 +573,7 @@ readruleset(void)
|
|||
parseerror("too many ports");
|
||||
if(lookup(r->qarg, badports) >= 0)
|
||||
parseerror("illegal port name %s", r->qarg);
|
||||
free(rs->port);
|
||||
rs->port = estrdup(r->qarg);
|
||||
}else
|
||||
ncmd++; /* start or client rule */
|
||||
|
|
Loading…
Reference in New Issue