[PATCH] Fix memory leak related to APETag

Xavier Duret xaviour.maillists at gmail.com
Mon Jan 22 19:37:47 CET 2007


An update of this patch to fix another leak in
UniqueFileIdentifierFrame. It did not seam to break binary
compatibility with my test program but then it uses the C bindings...

diff -ruN taglib.old/taglib/mpeg/mpegfile.cpp taglib/taglib/mpeg/mpegfile.cpp
--- taglib.old/taglib/mpeg/mpegfile.cpp 2007-01-17 16:01:31.000000000 +0100
+++ taglib/taglib/mpeg/mpegfile.cpp     2007-01-18 23:44:32.000000000 +0100
@@ -187,6 +187,7 @@

   ~FilePrivate() {
     delete ID3v2Tag;
+    delete APETag;
     delete ID3v1Tag;
     delete tag;
     delete properties;
diff -ruN taglib.old/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h
 taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h
--- taglib.old/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h
 2007-01-17 16:01:34.000000000 +0100
+++ taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h
2007-01-19 12:03:28.000000000 +0100
@@ -85,6 +85,7 @@

       virtual String toString() const;

+      ~UniqueFileIdentifierFrame();
     protected:
       virtual void parseFields(const ByteVector &data);
       virtual ByteVector renderFields() const;
diff -ruN taglib.old/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp
taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp
--- taglib.old/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp
 2007-01-17 16:01:34.000000000 +0100
+++ taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp
 2007-01-19 12:03:32.000000000 +0100
@@ -52,6 +52,11 @@
   d->identifier = id;
 }

+UniqueFileIdentifierFrame::~UniqueFileIdentifierFrame()
+{
+  delete d;
+}
+
 String UniqueFileIdentifierFrame::owner() const
 {
     return d->owner;


On 1/19/07, Xavier Duret <xaviour.maillists at gmail.com> wrote:
> I am running valgrind on my testsuite and found some memory leaks. The
> one related to APETag resulted in more than half a MB of memory loss.


More information about the taglib-devel mailing list