Very big and ugly memory leaks

Benoit Amiaux benoit.amiaux at laposte.net
Sun Apr 3 14:45:50 CEST 2005


Hello, two evil gremlins were hidden inside taglib. I spent a lot of
time chasing them in my code until I realized that the following piece
of code was leaking:

TagLib::MPC:File foo("blah.mpc");
delete foo;

It looks like as if nobody tested ape tag reading in musepack files :(

Anyway, here is a patch for the two of them. IMO it's a big enough bug
to trigger a new minor taglib release as any file with APE tags or any
musepack file will leak a lots of memory.

--- apeitem.cpp 2004-11-06 18:27:20.000000000 +0100
+++ apeitem.cpp 2005-04-03 14:25:39.336529936 +0200
@@ -62,6 +62,11 @@
   d = new ItemPrivate(*item.d);
 }

+APE::Item::~Item()
+{
+  delete d;
+}
+
 Item &APE::Item::operator=(const Item &item)
 {
   delete d;

--- mpcfile.cpp 2004-09-09 00:42:29.000000000 +0200
+++ mpcfile.cpp 2005-04-03 14:25:16.253039160 +0200
@@ -53,8 +53,9 @@

   ~FilePrivate()
   {
-    delete ID3v1Tag;
+    delete tag;
     delete properties;
+    delete ID3v2Header;
   }

   APE::Tag *APETag;





More information about the taglib-devel mailing list