[gobject-introspection] tests: Fix a memory leak



commit 9d9000cfd77bec72b39ee6fd1b4f8893c56bb27b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri May 25 16:00:38 2012 -0400

    tests: Fix a memory leak
    
    We need to unref the cairo surface here, as we are making the context
    be the sole owner of it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671687

 tests/scanner/regress.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index bcab7f8..ca8d6ef 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -294,8 +294,11 @@ cairo_t *
 regress_test_cairo_context_full_return (void)
 {
   cairo_surface_t *surface;
+  cairo_t *cr;
   surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
-  return cairo_create (surface);
+  cr = cairo_create (surface);
+  cairo_surface_destroy (surface);
+  return cr;
 }
 
 /**



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