[geocode-glib] tests: Fix some minor memory leaks in test-gcglib



commit f97421f6d949509e5d2e81695e9f83780fc33885
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Oct 13 16:18:51 2016 +0100

    tests: Fix some minor memory leaks in test-gcglib
    
    It’s now memory-leak-clean when run under valgrind.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756311

 geocode-glib/test-gcglib.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/geocode-glib/test-gcglib.c b/geocode-glib/test-gcglib.c
index ef2f51e..82a1a98 100644
--- a/geocode-glib/test-gcglib.c
+++ b/geocode-glib/test-gcglib.c
@@ -517,6 +517,8 @@ test_search (void)
 
        setlocale (LC_MESSAGES, old_locale);
        g_free (old_locale);
+
+       g_list_free_full (results, (GDestroyNotify) g_object_unref);
 }
 
 static void
@@ -616,7 +618,7 @@ test_osm_type (void)
 static void
 test_distance (void)
 {
-       GeocodeLocation *loca, *locb;
+       g_autoptr (GeocodeLocation) loca = NULL, locb = NULL;
 
        /* 1600 Pennsylvania Ave NW, Washington, DC */
        loca = geocode_location_new (38.898556, -77.037852, GEOCODE_LOCATION_ACCURACY_UNKNOWN);
@@ -871,7 +873,7 @@ new_loc (void)
 int main (int argc, char **argv)
 {
        GError *error = NULL;
-       GOptionContext *context;
+       g_autoptr (GOptionContext) context = NULL;
        gboolean do_rev_geocoding = FALSE;
        int answer_count = DEFAULT_ANSWER_COUNT;
        const GOptionEntry entries[] = {


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