[librsvg] Fix a little bunch of leaks in the test suite



commit 0c9f6eaadb5a4b1d91c57bb920d2f798d5047623
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Jan 9 13:48:39 2019 -0600

    Fix a little bunch of leaks in the test suite

 tests/api.c    | 14 ++++++++++++++
 tests/errors.c |  2 ++
 2 files changed, 16 insertions(+)
---
diff --git a/tests/api.c b/tests/api.c
index a59e7031..1f075a6c 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -200,6 +200,8 @@ set_dpi (void)
     g_assert_cmpint (dim.width,  ==, 400);
     g_assert_cmpint (dim.height, ==, 1200);
     g_object_unref (handle);
+
+    g_free (filename);
 }
 
 static void
@@ -270,6 +272,8 @@ handle_write_close_free (void)
     GError *error = NULL;
 
     g_assert (g_file_get_contents (filename, &data, &length, &error));
+    g_free (filename);
+
     g_assert (data != NULL);
     g_assert (error == NULL);
 
@@ -321,6 +325,8 @@ handle_new_from_data (void)
     GError *error = NULL;
 
     g_assert (g_file_get_contents (filename, &data, &length, &error));
+    g_free (filename);
+
     g_assert (data != NULL);
     g_assert (error == NULL);
 
@@ -421,6 +427,8 @@ handle_has_sub (void)
     g_assert (rsvg_handle_has_sub (handle, EXAMPLE_ONE_ID));
     g_assert (rsvg_handle_has_sub (handle, EXAMPLE_TWO_ID));
     g_assert (!rsvg_handle_has_sub (handle, "#foo"));
+
+    g_object_unref (handle);
 }
 
 static void
@@ -669,6 +677,8 @@ can_draw_to_non_image_surface (void)
     GError *error = NULL;
 
     RsvgHandle *handle = rsvg_handle_new_from_file (filename, &error);
+    g_free (filename);
+
     g_assert (handle != NULL);
     g_assert (error == NULL);
 
@@ -698,6 +708,7 @@ can_draw_to_non_image_surface (void)
     g_object_unref (handle);
 
     cairo_destroy (cr);
+    cairo_surface_destroy (surface);
 }
 
 /* Test that we preserve the affine transformation in the cr during a call
@@ -710,6 +721,8 @@ render_cairo_sub (void)
     GError *error = NULL;
 
     RsvgHandle *handle = rsvg_handle_new_from_file (filename, &error);
+    g_free (filename);
+
     g_assert (handle != NULL);
     g_assert (error == NULL);
 
@@ -730,6 +743,7 @@ render_cairo_sub (void)
 
     g_object_unref (handle);
     cairo_destroy (cr);
+    cairo_surface_destroy (surf);
 }
 
 /* https://gitlab.gnome.org/GNOME/librsvg/issues/385 */
diff --git a/tests/errors.c b/tests/errors.c
index bdf6db7b..b76974db 100644
--- a/tests/errors.c
+++ b/tests/errors.c
@@ -35,6 +35,8 @@ test_non_svg_element (void)
 
     g_assert (handle == NULL);
     g_assert (g_error_matches (error, RSVG_ERROR, RSVG_ERROR_FAILED));
+
+    g_error_free (error);
 }
 
 static void


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