From 428fc53a8319710bba3cf130ed7121c9d6732c24 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 14 Jan 2012 14:16:43 +0100 Subject: Don't leak the XMLContext that is created while loading an XML document The XMLContext is only relevant while an XML file is being parsed. So rather than allocating it on the heap and forgetting to delete it again, it's now allocated on the stack and thrown away automatically. Reviewed-by: Yohann Ferreira --- src/utils/xml.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 65eb1370..76f1d6df 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -48,10 +48,10 @@ namespace XML Document::Document(const std::string &filename, bool useResman): mDoc(0) { - XMLContext *ctx = new XMLContext(); - ctx->file = filename; - ctx->resman = useResman; - xmlSetStructuredErrorFunc(ctx, xmlLogger); + XMLContext ctx; + ctx.file = filename; + ctx.resman = useResman; + xmlSetStructuredErrorFunc(&ctx, xmlLogger); int size; char *data = NULL; -- cgit v1.2.3-70-g09d2