[easytag] Fix a memory leak when checking for a buggy id3lib



commit 0d003a2b88447981b1641c073899b4e315b4b702
Author: David King <amigadave amigadave com>
Date:   Wed Feb 6 17:49:08 2013 +0000

    Fix a memory leak when checking for a buggy id3lib

 src/id3_tag.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/id3_tag.c b/src/id3_tag.c
index bfcce83..43fec5a 100644
--- a/src/id3_tag.c
+++ b/src/id3_tag.c
@@ -1264,6 +1264,7 @@ gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
     guchar tmp[16] = {0xFF, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
     ID3Tag *id3_tag = NULL;
+    gchar *path;
     gchar *result = NULL;
     ID3Frame *id3_frame;
     gboolean use_unicode;
@@ -1321,7 +1322,8 @@ gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
     FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET = TRUE;
 
     id3_tag = ID3Tag_New();
-    ID3Tag_Link_1 (id3_tag, g_file_get_path (file));
+    path = g_file_get_path (file);
+    ID3Tag_Link_1 (id3_tag, path);
 
     // Create a new 'title' field for testing
     id3_frame = ID3Frame_NewID(ID3FID_TITLE);
@@ -1339,7 +1341,7 @@ gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
 
 
     id3_tag = ID3Tag_New();
-    ID3Tag_Link_1 (id3_tag, g_file_get_path (file));
+    ID3Tag_Link_1 (id3_tag, path);
     // Read the written field
     if ( (id3_frame = ID3Tag_FindFrameWithID(id3_tag,ID3FID_TITLE)) )
     {
@@ -1347,6 +1349,7 @@ gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
     }
 
     ID3Tag_Delete(id3_tag);
+    g_free (path);
     g_file_delete (file, NULL, NULL);
 
     g_object_unref (file);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]