tests: Fix a memory leak
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 25 May 2012 20:00:38 +0000 (16:00 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 25 May 2012 20:36:46 +0000 (16:36 -0400)
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

index bcab7f8..ca8d6ef 100644 (file)
@@ -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;
 }
 
 /**