diff options
author | randomdan <randomdan@localhost> | 2011-07-31 17:31:05 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2011-07-31 17:31:05 +0000 |
commit | 9eabfeac3e78e24903ce4b05f9f159e9bd2de855 (patch) | |
tree | d2ea6530d5ce0a9ed0e1d97ff135bb269cdde01b | |
parent | Allow all plugable components to have settings injected into them (diff) | |
download | project2-9eabfeac3e78e24903ce4b05f9f159e9bd2de855.tar.bz2 project2-9eabfeac3e78e24903ce4b05f9f159e9bd2de855.tar.xz project2-9eabfeac3e78e24903ce4b05f9f159e9bd2de855.zip |
Fix memory error handling the over encoding of xslRows
-rw-r--r-- | project2/xslRowsCache.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/project2/xslRowsCache.cpp b/project2/xslRowsCache.cpp index 7f6c8ec..5cbc44c 100644 --- a/project2/xslRowsCache.cpp +++ b/project2/xslRowsCache.cpp @@ -1,4 +1,5 @@ #include "xslRowsCache.h" +#include <string.h> #include <libxml/HTMLparser.h> #include "exceptions.h" @@ -16,11 +17,15 @@ class XslCachePopulator : public CurlCompleteCallback { url(u), html(h), warnings(w), - encoding(e) + encoding(e ? strdup(e) : NULL) { curl->setopt(CURLOPT_WRITEDATA, &buf); curl->setopt(CURLOPT_WRITEFUNCTION, &XslRowsCache::handleDataHelper); } + ~XslCachePopulator() + { + free(encoding); + } void call(CurlBulkFetcher *) { int flags = 0; @@ -39,7 +44,7 @@ class XslCachePopulator : public CurlCompleteCallback { const Glib::ustring url; const bool html; const bool warnings; - const char * encoding; + char * encoding; }; size_t |