Found with both ASan leak sanitizer and Valgrind. We were trivially
leaking the enum name for every arg parsed by the scanner which had one.
If libxml-based DTD validation was enabled, we would also leak the DTD
itself, despite diligently freeing the document, context, etc.

Signed-off-by: Daniel Stone <dani...@collabora.com>
---
 src/scanner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/scanner.c b/src/scanner.c
index 205c28a9..3afc3d3d 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -133,6 +133,7 @@ is_dtd_valid(FILE *input, const char *filename)
        rc = xmlValidateDtd(dtdctx, doc, dtd);
        xmlFreeDoc(doc);
        xmlFreeParserCtxt(ctx);
+       xmlFreeDtd(dtd);
        xmlFreeValidCtxt(dtdctx);
        /* xmlIOParseDTD consumes buffer */
 
@@ -432,6 +433,7 @@ free_arg(struct arg *arg)
        free(arg->name);
        free(arg->interface_name);
        free(arg->summary);
+       free(arg->enumeration_name);
        free(arg);
 }
 
-- 
2.17.1

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to