summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2022-04-13 14:46:38 +0100
committerRichard Hughes <richard@hughsie.com>2022-04-13 14:54:00 +0100
commit0883a64dba553b778e04175b0a5b7f1c3c135027 (patch)
tree895d1223c59bb743f0e4d4273550f7f9c2bcd83d
parentc1b51dc28627efbe8ff0d48ecb70e45085a1a9f6 (diff)
downloadappstream-glib-0883a64dba553b778e04175b0a5b7f1c3c135027.tar.gz
trivial: Fix a tiny memory leak on failure
-rw-r--r--libappstream-glib/as-ref-string.c4
1 files 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);
}