libxspf memory leak

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

libxspf memory leak

djczaski
Here are the details of the leak I see in case anyone else is interested. Any giveXXX() method with XspfData::TRANSFER will leak:

    this->d->props->giveInfo(makeAbsoluteUri(finalAccum), XspfData::TRANSFER);

This should transfer ownership of the memory to the library but doesn't because TRANSFER is false.
So, the giveXXX() and lendXXX() calls end up doing the same thing to deleteNewAndCopy.

    /*static*/ const bool XspfData::COPY = true;
    /*static*/ const bool XspfData::TRANSFER = false;
   
    void XspfData::giveInfo(XML_Char const * info, bool copy) {
        Toolbox::deleteNewAndCopy(this->d->info, this->d->ownInfo, info, copy);
    }
   
    void XspfData::lendInfo(XML_Char const * info) {
        Toolbox::deleteNewAndCopy(this->d->info, this->d->ownInfo, info, false);
    }

The last parameter of deleteNewAndCopy needs to be an enum of {COPY, TRANSFER, LEND} instead of a bool. This should be a relatively straightforward, if not tedious, fix.  Of course, I see that libxspf hasn't had a commit or release in over four years.  My guess is it's abandon-ware at this stage and nobody actually uses it.


_______________________________________________
Playlist mailing list
[hidden email]
http://lists.musicbrainz.org/mailman/listinfo/playlist