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