diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-14 14:16:43 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-15 00:23:19 +0100 |
commit | 428fc53a8319710bba3cf130ed7121c9d6732c24 (patch) | |
tree | e9de8cc1763cab77706a930fb3d7d4ad05dc9a60 /src/utils/xml.cpp | |
parent | d035c2c624d5fd2d27eed811d219cfd81e9063ef (diff) | |
download | mana-428fc53a8319710bba3cf130ed7121c9d6732c24.tar.gz mana-428fc53a8319710bba3cf130ed7121c9d6732c24.tar.bz2 mana-428fc53a8319710bba3cf130ed7121c9d6732c24.tar.xz mana-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
Diffstat (limited to 'src/utils/xml.cpp')
-rw-r--r-- | src/utils/xml.cpp | 8 |
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; |