Bug 301349

Summary: parser memleak
Product: [Applications] amarok Reporter: Harald Sitter <sitter>
Component: Services/MagnatuneAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: nhn
Priority: NOR    
Version: 2.5.90 (2.6 beta)   
Target Milestone: 2.6   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 2.7
Bug Depends on:    
Bug Blocks: 284087    

Description Harald Sitter 2012-06-07 12:15:29 UTC
==16848== 13,949,308 (2,404,864 direct, 11,544,444 indirect) bytes in 9,394 blocks are definitely lost in loss record 4,151 of 4,151
==16848==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16848==    by 0x28AC4152: MagnatuneXmlParser::parseTrack(QDomElement const&) (MagnatuneXmlParser.cpp:324)

The new in question:
> MagnatuneTrack * pCurrentTrack = new MagnatuneTrack( QString() );
subsequently added to a list
> m_currentAlbumTracksList.append( pCurrentTrack );
but never deleted it seems.

A strategically placed qDeleteAll in the dtor should take care of that.

Reproducible: Always

Steps to Reproduce:
1. wipe magnatune settings from amarokrc (update timestamp will prevent a rescan)
2. trigger a scan - e.g. disable and enable the store plugin
3. disable plugin once memory started growing
Actual Results:  
memory of MangatuneTracks not recovered

Expected Results:  
memory recovered

general note of interest: for validation purposes you might want to add debug statements to the ctor && dtor of the track class as memory usage alone will not paint an accurate picture. this is in particular because at least my Qt version has a leak in domdocument itself....
Comment 1 Edward Hades 2012-08-18 12:08:18 UTC
Git commit 5cefb6e013b629f139aba13802b0ac6a33d41e03 by Edward Hades.
Committed on 18/08/2012 at 14:07.
Pushed by hades into branch 'master'.

magnatune: remove memleak in xml parser
FIXED-IN: 2.7

M  +7    -12   src/services/magnatune/MagnatuneXmlParser.cpp
M  +4    -3    src/services/magnatune/MagnatuneXmlParser.h

http://commits.kde.org/amarok/5cefb6e013b629f139aba13802b0ac6a33d41e03