[gjs: 21/45] [cairo] Plug a few string leaks



commit e647c5be6b1af4e542f8e77f86c01e09043b4f25
Author: Johan Dahlin <johan gnome org>
Date:   Thu Feb 25 18:30:44 2010 -0300

    [cairo] Plug a few string leaks

 modules/cairo-pdf-surface.c |    3 +++
 modules/cairo-surface.c     |    4 +++-
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/modules/cairo-pdf-surface.c b/modules/cairo-pdf-surface.c
index dadbb8a..b328141 100644
--- a/modules/cairo-pdf-surface.c
+++ b/modules/cairo-pdf-surface.c
@@ -57,9 +57,12 @@ gjs_cairo_pdf_surface_constructor(JSContext *context,
     if (status != CAIRO_STATUS_SUCCESS) {
         gjs_throw(context, "Failed to create cairo surface: %s",
                   cairo_status_to_string(status));
+        g_free(filename);
         return JS_FALSE;
     }
+
     gjs_cairo_surface_construct(context, obj, surface);
+    g_free(filename);
 
     return JS_TRUE;
 }
diff --git a/modules/cairo-surface.c b/modules/cairo-surface.c
index 815504e..2847826 100644
--- a/modules/cairo-surface.c
+++ b/modules/cairo-surface.c
@@ -80,8 +80,10 @@ writeToPNG_func(JSContext *context,
         return JS_FALSE;
 
     surface = gjs_cairo_surface_get_surface(context, obj);
-    if (!surface)
+    if (!surface) {
+        g_free(filename);
         return JS_FALSE;
+    }
     cairo_surface_write_to_png(surface, filename);
     g_free(filename);
     return JS_TRUE;



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