r675 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Sat Aug 5 17:55:34 CEST 2006
Author: phk
Date: 2006-08-05 17:55:34 +0200 (Sat, 05 Aug 2006)
New Revision: 675
Modified:
trunk/varnish-cache/bin/varnishd/mgt_child.c
trunk/varnish-cache/bin/varnishd/mgt_vcc.c
Log:
Plug memory leaks related to starting/stopping child.
Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 15:40:41 UTC (rev 674)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 15:55:34 UTC (rev 675)
@@ -125,6 +125,7 @@
AZ(close(child_fds[1]));
child_fds[1] = -1;
+ assert(ev_listen == NULL);
e = ev_new();
assert(e != NULL);
e->fd = child_fds[0];
@@ -134,6 +135,7 @@
AZ(ev_add(mgt_evb, e));
ev_listen = e;
+ assert(ev_poker == NULL);
e = ev_new();
assert(e != NULL);
e->timeout = 3.0;
@@ -167,8 +169,10 @@
child_state = CH_STOPPING;
- if (ev_poker != NULL)
+ if (ev_poker != NULL) {
ev_del(mgt_evb, ev_poker);
+ free(ev_poker);
+ }
ev_poker = NULL;
printf("Clean child\n");
@@ -194,8 +198,10 @@
(void)e;
(void)what;
- if (ev_poker != NULL)
+ if (ev_poker != NULL) {
ev_del(mgt_evb, ev_poker);
+ free(ev_poker);
+ }
ev_poker = NULL;
r = wait4(-1, &status, WNOHANG, NULL);
@@ -219,8 +225,10 @@
heritage.fds[3] = -1;
}
- if (ev_listen != NULL)
+ if (ev_listen != NULL) {
ev_del(mgt_evb, ev_listen);
+ free(ev_listen);
+ }
ev_listen = NULL;
AZ(close(child_fds[0]));
Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 15:40:41 UTC (rev 674)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 15:55:34 UTC (rev 675)
@@ -178,13 +178,17 @@
if (mgt_cli_askchild(status, p,
"config.load %s %s\n", vp->name, vp->fname))
return (1);
- if (vp->active)
- if (mgt_cli_askchild(status, p,
+ free(*p);
+ if (vp->active &&
+ mgt_cli_askchild(status, p,
"config.use %s\n", vp->name, vp->fname))
return (1);
+ free(*p);
}
if (mgt_cli_askchild(status, p, "start\n"))
return (1);
+ free(*p);
+ *p = NULL;
return (0);
}
More information about the varnish-commit
mailing list