[librsvg] Fix two leaks out of callers of rsvg_defs_lookup()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [librsvg] Fix two leaks out of callers of rsvg_defs_lookup()
- Date: Wed, 19 Dec 2018 19:37:45 +0000 (UTC)
commit 0d76532def23c9304a9b0ed5294ed33d773e85bc
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 19 13:05:27 2018 -0600
    Fix two leaks out of callers of rsvg_defs_lookup()
 librsvg/rsvg-handle.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index 9dc3aacc..965de1ac 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -1063,6 +1063,7 @@ rsvg_handle_render_cairo_sub (RsvgHandle * handle, cairo_t * cr, const char *id)
     res = rsvg_drawing_ctx_draw_node_from_stack (draw);
 
     rsvg_drawing_ctx_free (draw);
+    drawsub = rsvg_node_unref (drawsub);
 
     cairo_restore (cr);
 
@@ -1255,6 +1256,9 @@ gboolean
 rsvg_handle_has_sub (RsvgHandle * handle,
                      const char *id)
 {
+    RsvgNode *node;
+    gboolean has_sub;
+
     g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
 
     if (!is_loaded (handle)) {
@@ -1264,7 +1268,12 @@ rsvg_handle_has_sub (RsvgHandle * handle,
     if (G_UNLIKELY (!id || !id[0]))
       return FALSE;
 
-    return rsvg_handle_defs_lookup (handle, id) != NULL;
+    node = rsvg_handle_defs_lookup (handle, id);
+    has_sub = node != NULL;
+
+    node = rsvg_node_unref (node);
+
+    return has_sub;
 }
 
 /**
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]