From 9eabfeac3e78e24903ce4b05f9f159e9bd2de855 Mon Sep 17 00:00:00 2001 From: randomdan Date: Sun, 31 Jul 2011 17:31:05 +0000 Subject: Fix memory error handling the over encoding of xslRows --- project2/xslRowsCache.cpp | 9 +++++++-- 1 file 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 #include #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 -- cgit v1.2.3