[gjs] importer: Fix memory leak



commit 32da4455744ae9d8750663e684f3b6a35513cd29
Author: Pavel Vasin <rat4vier gmail com>
Date:   Wed Nov 28 20:48:44 2012 +0400

    importer: Fix memory leak
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689284

 gjs/importer.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gjs/importer.c b/gjs/importer.c
index 2583b68..0cb81a7 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -280,6 +280,7 @@ file_get_utf16_contents (const char  *filename,
                          glong       *length,
                          GError     **error)
 {
+    jschar *result;
     gchar *contents;
     gsize utf8_length;
 
@@ -290,8 +291,11 @@ file_get_utf16_contents (const char  *filename,
     /* No cast here, so we get a warning in the
        (impossible?) case that gunichar2 is different
        from jschar */
-    return g_utf8_to_utf16 (contents, utf8_length,
-                            NULL, length, error);
+    result = g_utf8_to_utf16 (contents, utf8_length,
+                              NULL, length, error);
+
+    g_free (contents);
+    return result;
 }
 static JSObject *
 load_module_init(JSContext  *context,



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