summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-07-31 17:31:05 +0000
committerrandomdan <randomdan@localhost>2011-07-31 17:31:05 +0000
commit11861c945d6b4784921634ac8acf10efe4ddce5e (patch)
treed2ea6530d5ce0a9ed0e1d97ff135bb269cdde01b
parentAllow all plugable components to have settings injected into them (diff)
downloadproject2-11861c945d6b4784921634ac8acf10efe4ddce5e.tar.bz2
project2-11861c945d6b4784921634ac8acf10efe4ddce5e.tar.xz
project2-11861c945d6b4784921634ac8acf10efe4ddce5e.zip
Fix memory error handling the over encoding of xslRows
-rw-r--r--project2/xslRowsCache.cpp9
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