summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-06-14 23:44:53 +0200
committerThomas Haller <thaller@redhat.com>2020-07-01 15:42:06 +0200
commit1cf11ccbca12b545d6da8e963e9eeab7a2028b1e (patch)
treeec099587078bf5475934ed674bfb3b9b273a8003
parent03dc75902662eecb3deee5a3dfc77e132def26cf (diff)
downloadNetworkManager-1cf11ccbca12b545d6da8e963e9eeab7a2028b1e.tar.gz
libnm: fix leak in nm_utils_is_json_object()
Fixes: 32f78ae6c3ba ('libnm: expose nm_utils_is_json_object() utility function')
-rw-r--r--libnm-core/nm-utils.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index ca6b70ce20..de26ecb2e7 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -5484,7 +5484,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);
@@ -5521,7 +5521,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);