summaryrefslogtreecommitdiff
path: root/gsk/gskrendernodeimpl.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-10-10 09:07:34 +0200
committerTimm Bäder <mail@baedert.org>2017-10-10 09:49:35 +0200
commitaf734c4007c5cd12150d14a72dfc8ec84db3c5ec (patch)
tree2ebf3740fe991fb45ca3ebbcd269caec11769765 /gsk/gskrendernodeimpl.c
parent657983cfda4c84b3c9b8490e748b08ccbd47a81f (diff)
downloadgtk+-af734c4007c5cd12150d14a72dfc8ec84db3c5ec.tar.gz
rendernode: Don't leak mem_surface
Diffstat (limited to 'gsk/gskrendernodeimpl.c')
-rw-r--r--gsk/gskrendernodeimpl.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 13fbd0024b..b3a6e2455f 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -1749,6 +1749,7 @@ gsk_cairo_node_serialize (GskRenderNode *node)
int width, height;
int stride, i;
guchar *mem_surface, *data;
+ GVariant *result;
width = cairo_image_surface_get_width (self->surface);
height = cairo_image_surface_get_height (self->surface);
@@ -1760,17 +1761,18 @@ gsk_cairo_node_serialize (GskRenderNode *node)
for (i = 0; i < height; i++)
memcpy (mem_surface + i * width * 4, data + i * stride, width * 4);
- return g_variant_new ("(dddduu@au)",
- (double) node->bounds.origin.x, (double) node->bounds.origin.y,
- (double) node->bounds.size.width, (double) node->bounds.size.height,
- (guint32) width,
- (guint32) height,
- g_variant_new_fixed_array (G_VARIANT_TYPE ("u"),
- mem_surface,
- width * height,
- sizeof (guint32)));
-
+ result = g_variant_new ("(dddduu@au)",
+ (double) node->bounds.origin.x, (double) node->bounds.origin.y,
+ (double) node->bounds.size.width, (double) node->bounds.size.height,
+ (guint32) width,
+ (guint32) height,
+ g_variant_new_fixed_array (G_VARIANT_TYPE ("u"),
+ mem_surface,
+ width * height,
+ sizeof (guint32)));
g_free (mem_surface);
+
+ return result;
}
}