plumber: fix memory leaks

front
cinap_lenrek 2012-01-29 03:48:24 +01:00
parent 105ebc327a
commit 83b56186e4
2 changed files with 5 additions and 0 deletions

View File

@ -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;
}

View File

@ -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 */