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



commit 5ddceb7573e98e86d63d9807e2e6def516346cfa
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_dialog.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index bc01ba9..78e4ce3 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -3301,9 +3301,9 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
 
     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. */
@@ -3374,6 +3374,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
                 g_free(cddb_server_cgi_path);
                 g_free (proxy_hostname);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 return FALSE;
             }
 
@@ -3421,6 +3422,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
                 g_free (cddb_server_cgi_path);
                 g_free (proxy_hostname);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 return FALSE;
             }
             g_free(cddb_in);
@@ -3445,6 +3447,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
                 g_free(cddb_server_cgi_path);
                 g_free (proxy_hostname);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
                 return FALSE;
             }
@@ -3463,6 +3466,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
                 g_free(cddb_server_cgi_path);
                 g_free (proxy_hostname);
                 g_string_free (query_string, TRUE);
+                g_free (cddb_discid);
                 gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
                 if (file)
                     fclose(file);


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