Commit 92d48483 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Plug more insignificant leaks

Reported by LSAN.
parent 3d6f0daf
...@@ -176,10 +176,10 @@ process_thread(void *priv) ...@@ -176,10 +176,10 @@ process_thread(void *priv)
vlu = VLU_New(p, process_vlu_func, 1024); vlu = VLU_New(p, process_vlu_func, 1024);
while (!VLU_Fd(p->fd_from, vlu)) while (!VLU_Fd(p->fd_from, vlu))
continue; continue;
VLU_Destroy(vlu);
} }
r = wait4(p->pid, &p->status, 0, &ru); r = wait4(p->pid, &p->status, 0, &ru);
AZ(pthread_mutex_lock(&p->mtx)); AZ(pthread_mutex_lock(&p->mtx));
if (p->fd_to >= 0) if (p->fd_to >= 0)
......
...@@ -590,6 +590,7 @@ varnish_start(struct varnish *v) ...@@ -590,6 +590,7 @@ varnish_start(struct varnish *v)
macro_def(v->vl, v->name, "addr", "%s", h); macro_def(v->vl, v->name, "addr", "%s", h);
macro_def(v->vl, v->name, "port", "%s", p); macro_def(v->vl, v->name, "port", "%s", p);
macro_def(v->vl, v->name, "sock", "%s %s", h, p); macro_def(v->vl, v->name, "sock", "%s %s", h, p);
free(resp);
/* Wait for vsl logging to get underway */ /* Wait for vsl logging to get underway */
while (v->vsl_rec == 0) while (v->vsl_rec == 0)
VTIM_sleep(.1); VTIM_sleep(.1);
...@@ -602,7 +603,7 @@ varnish_start(struct varnish *v) ...@@ -602,7 +603,7 @@ varnish_start(struct varnish *v)
static void static void
varnish_stop(struct varnish *v) varnish_stop(struct varnish *v)
{ {
char *r; char *r = NULL;
if (v->cli_fd < 0) if (v->cli_fd < 0)
varnish_launch(v); varnish_launch(v);
...@@ -611,12 +612,14 @@ varnish_stop(struct varnish *v) ...@@ -611,12 +612,14 @@ varnish_stop(struct varnish *v)
vtc_log(v->vl, 2, "Stop"); vtc_log(v->vl, 2, "Stop");
(void)varnish_ask_cli(v, "stop", NULL); (void)varnish_ask_cli(v, "stop", NULL);
while (1) { while (1) {
r = NULL;
(void)varnish_ask_cli(v, "status", &r); (void)varnish_ask_cli(v, "status", &r);
AN(r); AN(r);
if (!strcmp(r, "Child in state stopped")) if (!strcmp(r, "Child in state stopped")) {
free(r);
break; break;
}
free(r); free(r);
r = NULL;
(void)sleep (1); (void)sleep (1);
/* XXX: should fail eventually */ /* XXX: should fail eventually */
} }
...@@ -672,8 +675,6 @@ varnish_cleanup(struct varnish *v) ...@@ -672,8 +675,6 @@ varnish_cleanup(struct varnish *v)
static void static void
varnish_wait(struct varnish *v) varnish_wait(struct varnish *v)
{ {
char *resp;
if (v->cli_fd < 0) if (v->cli_fd < 0)
return; return;
...@@ -681,7 +682,7 @@ varnish_wait(struct varnish *v) ...@@ -681,7 +682,7 @@ varnish_wait(struct varnish *v)
if (!vtc_error) { if (!vtc_error) {
/* Do a backend.list to log if child is still running */ /* Do a backend.list to log if child is still running */
(void)varnish_ask_cli(v, "backend.list", &resp); (void)varnish_ask_cli(v, "backend.list", NULL);
} }
/* Then stop it */ /* Then stop it */
...@@ -726,6 +727,7 @@ varnish_cli(struct varnish *v, const char *cli, unsigned exp, const char *re) ...@@ -726,6 +727,7 @@ varnish_cli(struct varnish *v, const char *cli, unsigned exp, const char *re)
vtc_fatal(v->vl, "Expect failed (%d)", err); vtc_fatal(v->vl, "Expect failed (%d)", err);
VRE_free(&vre); VRE_free(&vre);
} }
free(resp);
} }
/********************************************************************** /**********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment