free buffers after parsing
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Jul 2008 19:06:57 +0000 (21:06 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Jul 2008 19:06:57 +0000 (21:06 +0200)
ED2KLink.cpp

index 1a82066..e1ec2ff 100644 (file)
@@ -90,6 +90,7 @@ ED2KLink* ED2KLink::parseED2KLink(const char* buffer) {
 
        size = atol(sizeString);
        GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] parsed size “%s” into %d.\n", __FILE__, __LINE__, sizeString, size);
 
        size = atol(sizeString);
        GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] parsed size “%s” into %d.\n", __FILE__, __LINE__, sizeString, size);
+       free(sizeString);
 
        for (hashIndex = 0; hashIndex < 16; hashIndex++) {
                char byteBuffer[3];
 
        for (hashIndex = 0; hashIndex < 16; hashIndex++) {
                char byteBuffer[3];
@@ -99,7 +100,9 @@ ED2KLink* ED2KLink::parseED2KLink(const char* buffer) {
                GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] parsed ‘%c%c’ as %02x.\n", __FILE__, __LINE__, *(byteBuffer), *(byteBuffer + 1), hash[hashIndex]);
        }
 
                GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] parsed ‘%c%c’ as %02x.\n", __FILE__, __LINE__, *(byteBuffer), *(byteBuffer + 1), hash[hashIndex]);
        }
 
-       return new ED2KLink(filename, size, hash);
+       ED2KLink* ed2kLink = new ED2KLink(filename, size, hash);
+       free(filename);
+       return ed2kLink;
 }
 
 const char* ED2KLink::getLink() {
 }
 
 const char* ED2KLink::getLink() {