From: Michael Andres Date: Tue, 6 Jun 2006 20:27:42 +0000 (+0000) Subject: - fixed memory leak in XMLSourceCacheParser (#168690) X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~700 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8f0292a325fdf936be8d11d3eee9c0285a4643f;p=platform%2Fupstream%2Flibzypp.git - fixed memory leak in XMLSourceCacheParser (#168690) --- diff --git a/package/libzypp.changes b/package/libzypp.changes index 7f6329a..f47ab39 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,17 +1,22 @@ ------------------------------------------------------------------- +Tue Jun 6 22:24:00 CEST 2006 - ma@suse.de + +- fixed memory leak in XMLSourceCacheParser (#168690) + +------------------------------------------------------------------- Fri Jun 2 16:09:03 CEST 2006 - schubi@suse.de -latest fi translation added - Revision 3502 + Revision 3502 ------------------------------------------------------------------- Thu Jun 1 15:11:47 CEST 2006 - schubi@suse.de --All installed resolvables has been set to "satisfied" in +-All installed resolvables has been set to "satisfied" in ResolverContext::unneeded . BUT: Patch concerning resolvables have to be set to "unneeded" although they are installed. In order - getting the state "no longer applicable" (Bug 171590) + getting the state "no longer applicable" (Bug 171590) - rev 3496 ------------------------------------------------------------------- @@ -26,24 +31,24 @@ Thu Jun 1 13:57:48 CEST 2006 - dmacvicar@suse.de - revert not-used-yet rpmdb timestamp, as it broke rpmdb::init(). (#180040) -- rev 3490 +- rev 3490 ------------------------------------------------------------------- Thu Jun 1 11:03:34 CEST 2006 - schubi@suse.de -- updating gmo files, if po files has been changed; bug 164449 +- updating gmo files, if po files has been changed; bug 164449 ------------------------------------------------------------------- Wed May 31 18:32:58 CEST 2006 - dmacvicar@suse.de - Dont download twice if starting from 1st time - fix typo -- rev 3481 +- rev 3481 ------------------------------------------------------------------- Wed May 31 17:06:48 CEST 2006 - dmacvicar@suse.de -- set cache dir only if storeMetadata is called as a public method.´ +- set cache dir only if storeMetadata is called as a public method.´ - rev 3475 ------------------------------------------------------------------- @@ -53,12 +58,12 @@ Wed May 31 15:27:38 CEST 2006 - kkaempf@suse.de - it freshens / supplements something - it is not installed yet (#178721) -- rev 3473 +- rev 3473 ------------------------------------------------------------------- Wed May 31 15:22:43 CEST 2006 - dmacvicar@suse.de -- make susetags also implement download and check first. +- make susetags also implement download and check first. - rev 3470 ------------------------------------------------------------------- @@ -80,7 +85,7 @@ Wed May 24 16:57:54 CEST 2006 - dmacvicar@suse.de - actually use the license to confirm in yum patches - add prerequires tag in yum optonally to the bad designed and nonintuitive pre=1 -- rev 3448 +- rev 3448 ------------------------------------------------------------------- Wed May 24 15:30:32 CEST 2006 - dmacvicar@suse.de @@ -88,8 +93,8 @@ Wed May 24 15:30:32 CEST 2006 - dmacvicar@suse.de - dont pass root on init but before. - implement rpm db modification timestamp   not used yet -- move Helix source to testsuite out of the solver - so we can use it for target, storage tests +- move Helix source to testsuite out of the solver + so we can use it for target, storage tests - add Source_Ref::timestamp(), default to now()   in order to implement smart sync of sources by zmd - don't parse desc and summary twice @@ -100,7 +105,7 @@ Wed May 24 15:30:32 CEST 2006 - dmacvicar@suse.de ------------------------------------------------------------------- Tue May 23 20:53:27 CEST 2006 - dmacvicar@suse.de -- dont accept corrupt sources, improve logs +- dont accept corrupt sources, improve logs ------------------------------------------------------------------- Tue May 23 17:26:41 CEST 2006 - ma@suse.de diff --git a/zypp/parser/xmlstore/XMLSourceCacheParser.cc b/zypp/parser/xmlstore/XMLSourceCacheParser.cc index b9f32c4..f729c48 100644 --- a/zypp/parser/xmlstore/XMLSourceCacheParser.cc +++ b/zypp/parser/xmlstore/XMLSourceCacheParser.cc @@ -30,32 +30,32 @@ namespace xmlstore { XMLSourceCacheParser::XMLSourceCacheParser() { } - + XMLSourceCacheParser::XMLSourceCacheParser(SourceData_Ptr& entry) : zypp::parser::XMLNodeIterator(entry) { } - - + + XMLSourceCacheParser::~XMLSourceCacheParser() { } - - + + // select for which elements process() will be called - bool + bool XMLSourceCacheParser::isInterested(const xmlNodePtr nodePtr) { return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "source"; } - + // do the actual processing SourceData_Ptr XMLSourceCacheParser::process(const xmlTextReaderPtr reader) { assert(reader); - SourceData_Ptr dataPtr = new PersistentStorage::SourceData; + SourceData_Ptr dataPtr( new PersistentStorage::SourceData ); xmlNodePtr dataNode = xmlTextReaderExpand(reader); assert(dataNode); - + for (xmlNodePtr child = dataNode->children; child && child != dataNode; child = child->next) { if (_helper.isElement(child)) @@ -98,13 +98,13 @@ namespace xmlstore { } return dataPtr; } /* end process */ - - + + XMLSourceCacheParser::XMLSourceCacheParser(istream &is, const string &baseUrl) : zypp::parser::XMLNodeIterator(is, baseUrl, SOURCESCHEMA) - { + { fetchNext(); } -} +} } // namespace parser } // namespace zypp diff --git a/zypp/parser/xmlstore/XMLSourceCacheParser.h b/zypp/parser/xmlstore/XMLSourceCacheParser.h index 3469504..b299ec6 100644 --- a/zypp/parser/xmlstore/XMLSourceCacheParser.h +++ b/zypp/parser/xmlstore/XMLSourceCacheParser.h @@ -18,14 +18,13 @@ #include #include -typedef zypp::storage::PersistentStorage::SourceData* SourceData_Ptr; - namespace zypp { namespace parser { namespace xmlstore { + typedef shared_ptr SourceData_Ptr; /* * Use this class as an iterator that produces, one after one, @@ -48,13 +47,13 @@ namespace xmlstore */ class XMLSourceCacheParser : public zypp::parser::XMLNodeIterator - { + { public: XMLSourceCacheParser(std::istream &is, const std::string &baseUrl); XMLSourceCacheParser(); XMLSourceCacheParser(SourceData_Ptr & entry); virtual ~XMLSourceCacheParser(); - + private: virtual bool isInterested(const xmlNodePtr nodePtr); virtual SourceData_Ptr process(const xmlTextReaderPtr reader);