From eec7872da14e34d572b06e41e959a59259164a20 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 8 Dec 2009 16:07:21 +0000 Subject: [PATCH] Possible Memory leak: tag git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@30 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e29964bb2035c874805e7e13eb6e7b2daccce87e Author: Jacek Jendrzej Date: 2009-12-08 (Tue, 08 Dec 2009) ------------------ This commit was generated by Migit --- lib/xmltree/xmlparse.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/xmltree/xmlparse.cpp b/lib/xmltree/xmlparse.cpp index 666976bb0..df771fcfa 100644 --- a/lib/xmltree/xmlparse.cpp +++ b/lib/xmltree/xmlparse.cpp @@ -757,8 +757,10 @@ enum XML_Error XML_Parser::doContent(int startTagLevel, const ENCODING *enc, con if (!tag) return XML_ERROR_NO_MEMORY; tag->buf=new char[INIT_TAG_BUF_SIZE]; - if (!tag->buf) return XML_ERROR_NO_MEMORY; - + if (!tag->buf){ + delete tag; + return XML_ERROR_NO_MEMORY; + } tag->bufEnd=tag->buf+INIT_TAG_BUF_SIZE; } @@ -775,8 +777,10 @@ enum XML_Error XML_Parser::doContent(int startTagLevel, const ENCODING *enc, con int bufSize=ROUND_UP(tag->rawNameLength*4, sizeof(XML_Char)); tag->buf=(char *) realloc(tag->buf, bufSize); - if (!tag->buf) return XML_ERROR_NO_MEMORY; - + if (!tag->buf){ + delete tag; + return XML_ERROR_NO_MEMORY; + } tag->bufEnd=tag->buf+bufSize; }; @@ -812,8 +816,10 @@ enum XML_Error XML_Parser::doContent(int startTagLevel, const ENCODING *enc, con bufSize=(tag->bufEnd-tag->buf) << 1; tag->buf=(char *) realloc(tag->buf, bufSize); - if (!tag->buf) return XML_ERROR_NO_MEMORY; - + if (!tag->buf){ + delete tag; + return XML_ERROR_NO_MEMORY; + } tag->bufEnd=tag->buf+bufSize; if (nextPtr) tag->rawName=tag->buf;