Commit b776a5bb authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Plug even more memory leaks in the VCL compiler.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1704 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 71b2c559
......@@ -514,6 +514,7 @@ static char *
vcc_DestroyTokenList(struct tokenlist *tl, char *ret)
{
struct membit *mb;
struct source *sp;
int i;
while (!TAILQ_EMPTY(&tl->membits)) {
......@@ -522,6 +523,11 @@ vcc_DestroyTokenList(struct tokenlist *tl, char *ret)
free(mb->ptr);
free(mb);
}
while (!TAILQ_EMPTY(&tl->sources)) {
sp = TAILQ_FIRST(&tl->sources);
TAILQ_REMOVE(&tl->sources, sp, list);
vcc_destroy_source(sp);
}
vsb_delete(tl->fh);
vsb_delete(tl->fc);
......@@ -658,7 +664,6 @@ VCC_Compile(struct vsb *sb, const char *b, const char *e)
if (sp == NULL)
return (NULL);
r = vcc_CompileSource(sb, sp);
vcc_destroy_source(sp);
return (r);
}
......@@ -677,7 +682,6 @@ VCC_CompileFile(struct vsb *sb, const char *fn, int fd)
if (sp == NULL)
return (NULL);
r = vcc_CompileSource(sb, sp);
vcc_destroy_source(sp);
return (r);
}
......
......@@ -209,7 +209,7 @@ vcc_decstr(struct tokenlist *tl)
unsigned char u;
assert(tl->t->tok == CSTR);
tl->t->dec = malloc((tl->t->e - tl->t->b) - 1);
tl->t->dec = TlAlloc(tl, (tl->t->e - tl->t->b) - 1);
assert(tl->t->dec != NULL);
q = tl->t->dec;
for (p = tl->t->b + 1; p < tl->t->e - 1; ) {
......
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