[master] adb48856c vcc: Plug minor leak
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Jul 20 07:17:07 UTC 2020
commit adb48856c138d4a4b9f127ca141d2cb3f91ef11f
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Jul 20 09:07:16 2020 +0200
vcc: Plug minor leak
Spotted by Coverity
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index b181dc67d..f3e5b3b0b 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -523,6 +523,23 @@ vcc_new_source(const char *b, const char *e, const char *name)
/*--------------------------------------------------------------------*/
+static void
+vcc_destroy_source(struct source **spp)
+{
+ struct source *sp;
+
+ AN(spp);
+ sp = *spp;
+ *spp = NULL;
+
+ AN(sp);
+ free(sp->name);
+ free(sp->freeit);
+ free(sp);
+}
+
+/*--------------------------------------------------------------------*/
+
static struct source *
vcc_file_source(const struct vcc *tl, const char *fn)
{
@@ -620,6 +637,7 @@ vcc_resolve_includes(struct vcc *tl)
if (sp1->parent_tok)
vcc_ErrWhere(tl, sp1->parent_tok);
}
+ vcc_destroy_source(&sp);
return;
}
sp->parent = t->src;
More information about the varnish-commit
mailing list