From 5bcaf39b325c0748d2e720dfc91426b5a8c5c693 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Wed, 1 Dec 2021 08:51:48 +0100 Subject: jpeginfo: fix a minor memory leak --- tools/jpeginfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/jpeginfo.c b/tools/jpeginfo.c index fcfda0e..f8e723d 100644 --- a/tools/jpeginfo.c +++ b/tools/jpeginfo.c @@ -155,9 +155,10 @@ add_to_subarray(jv o, const char *key, jv value) { // Invalid values are not allocated, and we use up any valid one. // Beware that jv_get() returns jv_null() rather than jv_invalid(). + // Also, the header comment is lying, jv_is_valid() doesn't unreference. jv a = jv_object_get(jv_copy(o), jv_string(key)); return jv_set(o, jv_string(key), - jv_is_valid(jv_copy(a)) ? jv_array_append(a, value) : JV_ARRAY(value)); + jv_is_valid(a) ? jv_array_append(a, value) : JV_ARRAY(value)); } static jv -- cgit v1.2.3-70-g09d2