[easytag] Fix several memory leaks found by cppcheck



commit 62b84d6e00cacd49a42349b46dd77c96acadd07e
Author: David King <amigadave amigadave com>
Date:   Tue Feb 5 17:15:03 2013 +0000

    Fix several memory leaks found by cppcheck

 src/easytag.c    |    5 +++--
 src/id3v24_tag.c |    1 +
 src/picture.c    |    1 +
 3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/easytag.c b/src/easytag.c
index 9f0602c..1bf74ac 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -2818,10 +2818,10 @@ Write_File_Tag (ET_File *ETFile, gboolean hide_msgbox)
 #endif
         default:
             msg = g_strdup (g_strerror (errno));
+            msg1 = g_strdup_printf (_("Cannot write tag in file '%s' (%s)"),
+                                    basename_utf8, msg);
     }
 
-    msg1 = g_strdup_printf(_("Cannot write tag in file '%s' (%s)"),
-                           basename_utf8,msg);
     Log_Print(LOG_ERROR,"%s", msg1);
     g_free(msg1);
 
@@ -3078,6 +3078,7 @@ Rename_File (ET_File *ETFile, gboolean hide_msgbox)
 
         Statusbar_Message(_("File(s) not renamedâ"),TRUE);
 
+        g_free (tmp_filename);
         g_free(new_basename_utf8);
         g_free(cur_basename_utf8);
         return FALSE;
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index ed93153..4caf01b 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -130,6 +130,7 @@ gboolean Id3tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
     if (read(tmpfile, string1, ID3_TAG_QUERYSIZE) != ID3_TAG_QUERYSIZE)
     {
         close(tmpfile);
+        g_free (string1);
         return FALSE;
     }
 
diff --git a/src/picture.c b/src/picture.c
index 81195d6..3ba2373 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -1122,6 +1122,7 @@ Picture_Load_File_Data (const gchar *filename)
         gtk_widget_destroy(msgdialog);
 
         Log_Print(LOG_ERROR,_("Picture file not loaded (%s)â"),g_strerror(errno));
+        g_free (buffer);
         g_free(filename_utf8);
 #ifdef G_OS_WIN32
         g_free(filename);



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