Commit cffcca55 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Plug some leaks

parent ec0f8199
...@@ -167,7 +167,7 @@ macro_undef(struct vtclog *vl, const char *instance, const char *name) ...@@ -167,7 +167,7 @@ macro_undef(struct vtclog *vl, const char *instance, const char *name)
VTAILQ_REMOVE(&macro_list, m, list); VTAILQ_REMOVE(&macro_list, m, list);
free(m->name); free(m->name);
free(m->val); free(m->val);
free(m); FREE_OBJ(m);
} }
AZ(pthread_mutex_unlock(&macro_mtx)); AZ(pthread_mutex_unlock(&macro_mtx));
} }
......
...@@ -56,7 +56,7 @@ struct haproxy { ...@@ -56,7 +56,7 @@ struct haproxy {
struct vtclog *vl; struct vtclog *vl;
VTAILQ_ENTRY(haproxy) list; VTAILQ_ENTRY(haproxy) list;
char *filename; const char *filename;
struct vsb *args; struct vsb *args;
int opt_worker; int opt_worker;
int opt_daemon; int opt_daemon;
...@@ -72,7 +72,7 @@ struct haproxy { ...@@ -72,7 +72,7 @@ struct haproxy {
int expect_signal; int expect_signal;
int its_dead_jim; int its_dead_jim;
const char *cli_fn; char *cli_fn;
char *workdir; char *workdir;
struct vsb *msgs; struct vsb *msgs;
...@@ -152,7 +152,7 @@ haproxy_new(const char *name) ...@@ -152,7 +152,7 @@ haproxy_new(const char *name)
h->filename = getenv(HAPROXY_PROGRAM_ENV_VAR); h->filename = getenv(HAPROXY_PROGRAM_ENV_VAR);
if (h->filename == NULL) if (h->filename == NULL)
REPLACE(h->filename, "haproxy"); h->filename = "haproxy";
bprintf(buf, "${tmpdir}/%s", name); bprintf(buf, "${tmpdir}/%s", name);
vsb = macro_expand(h->vl, buf); vsb = macro_expand(h->vl, buf);
...@@ -196,6 +196,9 @@ haproxy_delete(struct haproxy *h) ...@@ -196,6 +196,9 @@ haproxy_delete(struct haproxy *h)
free(h->name); free(h->name);
free(h->workdir); free(h->workdir);
free(h->cli_fn);
free(h->cfg_fn);
free(h->pid_fn);
VSB_destroy(&h->args); VSB_destroy(&h->args);
/* XXX: MEMLEAK (?) */ /* XXX: MEMLEAK (?) */
......
...@@ -884,6 +884,7 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp, ...@@ -884,6 +884,7 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
} }
} else if (!strcmp(*av, "-bodylen")) { } else if (!strcmp(*av, "-bodylen")) {
assert(body == nullbody); assert(body == nullbody);
free(body);
body = synth_body(av[1], 0); body = synth_body(av[1], 0);
bodylen = strlen(body); bodylen = strlen(body);
av++; av++;
...@@ -895,13 +896,16 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp, ...@@ -895,13 +896,16 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
av++; av++;
} else if (!strcmp(*av, "-gziplen")) { } else if (!strcmp(*av, "-gziplen")) {
assert(body == nullbody); assert(body == nullbody);
free(body);
b = synth_body(av[1], 1); b = synth_body(av[1], 1);
gzip_body(hp, b, &body, &bodylen); gzip_body(hp, b, &body, &bodylen);
free(b);
VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl); VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl);
// vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen); // vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen);
av++; av++;
} else if (!strcmp(*av, "-gzipbody")) { } else if (!strcmp(*av, "-gzipbody")) {
assert(body == nullbody); assert(body == nullbody);
free(body);
gzip_body(hp, av[1], &body, &bodylen); gzip_body(hp, av[1], &body, &bodylen);
VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl); VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl);
// vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen); // vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen);
...@@ -1911,7 +1915,8 @@ http_process(struct vtclog *vl, const char *spec, int sock, int *sfd, ...@@ -1911,7 +1915,8 @@ http_process(struct vtclog *vl, const char *spec, int sock, int *sfd,
free(hp->rxbuf); free(hp->rxbuf);
free(hp->rem_ip); free(hp->rem_ip);
free(hp->rem_port); free(hp->rem_port);
free(hp); free(hp->rem_path);
FREE_OBJ(hp);
return (retval); return (retval);
} }
......
...@@ -191,6 +191,7 @@ logexp_delete(struct logexp *le) ...@@ -191,6 +191,7 @@ logexp_delete(struct logexp *le)
AZ(le->vslq); AZ(le->vslq);
logexp_delete_tests(le); logexp_delete_tests(le);
free(le->name); free(le->name);
free(le->vname);
free(le->query); free(le->query);
VSM_Destroy(&le->vsm); VSM_Destroy(&le->vsm);
FREE_OBJ(le); FREE_OBJ(le);
......
...@@ -386,6 +386,7 @@ process_new(const char *name) ...@@ -386,6 +386,7 @@ process_new(const char *name)
static void static void
process_delete(struct process *p) process_delete(struct process *p)
{ {
int i;
CHECK_OBJ_NOTNULL(p, PROCESS_MAGIC); CHECK_OBJ_NOTNULL(p, PROCESS_MAGIC);
AZ(pthread_mutex_destroy(&p->mtx)); AZ(pthread_mutex_destroy(&p->mtx));
...@@ -401,6 +402,10 @@ process_delete(struct process *p) ...@@ -401,6 +402,10 @@ process_delete(struct process *p)
* to the test's tmpdir. * to the test's tmpdir.
*/ */
for (i = 0; i < p->nlin; i++)
free(p->vram[i]);
free(p->vram);
/* XXX: MEMLEAK (?) */ /* XXX: MEMLEAK (?) */
FREE_OBJ(p); FREE_OBJ(p);
} }
......
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