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