summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-01-14 14:16:43 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-01-15 00:23:19 +0100
commit428fc53a8319710bba3cf130ed7121c9d6732c24 (patch)
treee9de8cc1763cab77706a930fb3d7d4ad05dc9a60
parentd035c2c624d5fd2d27eed811d219cfd81e9063ef (diff)
downloadmana-client-428fc53a8319710bba3cf130ed7121c9d6732c24.tar.gz
mana-client-428fc53a8319710bba3cf130ed7121c9d6732c24.tar.bz2
mana-client-428fc53a8319710bba3cf130ed7121c9d6732c24.tar.xz
mana-client-428fc53a8319710bba3cf130ed7121c9d6732c24.zip
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
-rw-r--r--src/utils/xml.cpp8
1 files changed, 4 insertions, 4 deletions
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;