[easytag] Fix memory leak in et_get_file_size()



commit 09f96fd0c9056c48e041fc3ec92a845c6840eeae
Author: David King <amigadave amigadave com>
Date:   Tue Feb 11 10:27:42 2014 +0000

    Fix memory leak in et_get_file_size()
    
    Unref the GFileInfo and GFile after use.

 src/misc.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index a5ccf31..e741197 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1124,6 +1124,7 @@ et_get_file_size (const gchar *filename)
     GFileInfo *info;
     /* TODO: Take a GError from the caller. */
     GError *error = NULL;
+    goffset size;
 
     g_return_val_if_fail (filename != NULL, 0);
 
@@ -1138,7 +1139,12 @@ et_get_file_size (const gchar *filename)
         return FALSE;
     }
 
-    return g_file_info_get_size (info);
+    g_object_unref (file);
+
+    size = g_file_info_get_size (info);
+    g_object_unref (info);
+
+    return size;
 }
 
 


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