[easytag/easytag-2-2] Avoid a memory leak of the disc ID in error paths



commit 8df083008262bf8abde3ca9beba2e122941a7668
Author: David King <amigadave amigadave com>
Date:   Wed Oct 8 20:14:50 2014 +0100

    Avoid a memory leak of the disc ID in error paths

 src/cddb.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/cddb.c b/src/cddb.c
index e837c10..a3bb965 100644
--- a/src/cddb.c
+++ b/src/cddb.c
@@ -3061,9 +3061,9 @@ Cddb_Search_Album_From_Selected_Files (void)
 
     g_list_free_full (file_iterlist, (GDestroyNotify)g_free);
 
-    // Compute CddbId
-    cddb_discid = g_strdup_printf("%08x",(guint)(((total_id % 0xFF) << 24) |
-                                         (disc_length << 8) | num_tracks));
+    /* Compute CddbId. */
+    cddb_discid = g_strdup_printf ("%08x", (guint)(((total_id % 0xFF) << 24) |
+                                           (disc_length << 8) | num_tracks));
 
 
     /* Delete previous album list. */
@@ -3234,6 +3234,7 @@ Cddb_Search_Album_From_Selected_Files (void)
                 g_free(cddb_server_name);
                 g_free(cddb_server_cgi_path);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 return FALSE;
             }
 
@@ -3277,6 +3278,7 @@ Cddb_Search_Album_From_Selected_Files (void)
                 g_free(cddb_server_name);
                 g_free(cddb_server_cgi_path);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 return FALSE;
             }
             g_free(cddb_in);
@@ -3300,6 +3302,7 @@ Cddb_Search_Album_From_Selected_Files (void)
                 g_free(cddb_server_name);
                 g_free(cddb_server_cgi_path);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
                 gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
                 return FALSE;
@@ -3317,6 +3320,7 @@ Cddb_Search_Album_From_Selected_Files (void)
                 g_free(cddb_server_name);
                 g_free(cddb_server_cgi_path);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
                 gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
                 if (file)


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