summaryrefslogtreecommitdiffstats
path: root/main/audacious/audacious-2.4.3-id3v1-memleak-AUD-286.patch
blob: 7dd3cdf63b24fc0cf19a843322ce0c03761898ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff -Nur audacious-2.4.3-orig/src/libaudtag/id3/id3v1.c audacious-2.4.3/src/libaudtag/id3/id3v1.c
--- audacious-2.4.3-orig/src/libaudtag/id3/id3v1.c	2011-01-12 12:07:37.000000000 +0100
+++ audacious-2.4.3/src/libaudtag/id3/id3v1.c	2011-01-28 23:31:15.356395589 +0100
@@ -96,8 +96,7 @@
         gchar *tmp_artist = g_strconcat(artist, convert_to_utf8(read_char_data(f, 60)), NULL);
         gchar *tmp_album = g_strconcat(album, convert_to_utf8(read_char_data(f, 60)), NULL);
         vfs_fseek(f, -170, SEEK_END);
-        gchar *tmp_genre = g_new0(gchar, 30);
-        tmp_genre = convert_to_utf8(read_char_data(f, 30));
+        gchar *tmp_genre = convert_to_utf8(read_char_data(f, 30));
         g_free(title);
         g_free(artist);
         g_free(album);
@@ -105,13 +104,12 @@
         artist = tmp_artist;
         album = tmp_album;
 
-        if (g_strcmp0(tmp_genre, NULL) == 1)
+        if (tmp_genre != NULL)
         {
             tuple_associate_string(tuple, FIELD_GENRE, NULL, tmp_genre);
             genre_set = TRUE;
+            g_free(tmp_genre);
         }
-
-        g_free(tmp_genre);
     }
 
     tuple_associate_string(tuple, FIELD_TITLE, NULL, title);