From 0883a64dba553b778e04175b0a5b7f1c3c135027 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 13 Apr 2022 14:46:38 +0100 Subject: trivial: Fix a tiny memory leak on failure --- libappstream-glib/as-ref-string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libappstream-glib/as-ref-string.c b/libappstream-glib/as-ref-string.c index 747ae48..f45c959 100644 --- a/libappstream-glib/as-ref-string.c +++ b/libappstream-glib/as-ref-string.c @@ -306,7 +306,7 @@ as_ref_string_sort_by_refcnt_cb (gconstpointer a, gconstpointer b) gchar * as_ref_string_debug (AsRefStringDebugFlags flags) { - GString *tmp = g_string_new (NULL); + g_autoptr(GString) tmp = g_string_new (NULL); g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&as_ref_string_mutex); /* not yet enabled */ @@ -382,5 +382,5 @@ as_ref_string_debug (AsRefStringDebugFlags flags) } } } - return g_string_free (tmp, FALSE); + return g_string_free (g_steal_pointer(&tmp), FALSE); } -- cgit v1.2.1