[gnome-autoar] Fix memory leak



commit aa3e62c09703f1f67b695eeca5cbf3e7f30f3ce0
Author: Ting-Wei Lan <lantw44 gmail com>
Date:   Fri Aug 30 10:11:38 2013 +0800

    Fix memory leak

 gnome-autoar/autoar-extract.c |    1 +
 gnome-autoar/autoar-pref.c    |    4 +++-
 tests/test-pref.c             |    1 +
 3 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gnome-autoar/autoar-extract.c b/gnome-autoar/autoar-extract.c
index 529c3f8..9de45a6 100644
--- a/gnome-autoar/autoar-extract.c
+++ b/gnome-autoar/autoar-extract.c
@@ -1374,6 +1374,7 @@ autoar_extract_new_full (const char *source,
     char *source_basename = g_file_get_basename (arextract->priv->source_file);
     arextract->priv->suggested_destname =
       autoar_common_get_basename_remove_extension (source_basename);
+    g_free (source_basename);
   }
 
   g_free (gen_source);
diff --git a/gnome-autoar/autoar-pref.c b/gnome-autoar/autoar-pref.c
index 252ac75..ed563bc 100644
--- a/gnome-autoar/autoar-pref.c
+++ b/gnome-autoar/autoar-pref.c
@@ -555,7 +555,7 @@ autoar_pref_check_mime_type_file  (AutoarPref *arpref,
 {
   GFileInfo *fileinfo;
   const char *content_type;
-  const char *mime_type;
+  char *mime_type;
   gboolean result;
 
   g_return_val_if_fail (AUTOAR_IS_PREF (arpref), FALSE);
@@ -576,6 +576,8 @@ autoar_pref_check_mime_type_file  (AutoarPref *arpref,
   g_debug ("MIME Type: %s\n", mime_type);
 
   result = autoar_pref_check_mime_type_d (arpref, mime_type);
+
+  g_free (mime_type);
   g_object_unref (fileinfo);
 
   return result;
diff --git a/tests/test-pref.c b/tests/test-pref.c
index b5d317e..af8f8e1 100644
--- a/tests/test-pref.c
+++ b/tests/test-pref.c
@@ -26,6 +26,7 @@ main (int argc,
            autoar_pref_check_mime_type (arpref, argv[1]),
            autoar_pref_check_mime_type_file (arpref, file));
 
+  g_object_unref (settings);
   g_object_unref (arpref);
   g_object_unref (file);
 


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