From 49ec86092b7838bdffcf64ccc232a4b9e5a24562 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 14 Jun 2020 23:44:53 +0200 Subject: [PATCH] libnm: fix leak in nm_utils_is_json_object() Fixes: 32f78ae6c3ba ('libnm: expose nm_utils_is_json_object() utility function') (cherry picked from commit 1cf11ccbca12b545d6da8e963e9eeab7a2028b1e) --- libnm-core/nm-utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index c88afb3238..425c302713 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -5428,7 +5428,7 @@ gboolean nm_utils_is_json_object (const char *str, GError **error) { #if WITH_JSON_VALIDATION - json_t *json; + nm_auto_decref_json json_t *json = NULL; json_error_t jerror; g_return_val_if_fail (!error || !*error, FALSE); @@ -5465,7 +5465,6 @@ nm_utils_is_json_object (const char *str, GError **error) return FALSE; } - json_decref (json); return TRUE; #else /* !WITH_JSON_VALIDATION */ g_return_val_if_fail (!error || !*error, FALSE);