jpeginfo: fix a minor memory leak

This commit is contained in:
Přemysl Eric Janouch 2021-12-01 08:51:48 +01:00
parent 9c77aac640
commit 5bcaf39b32
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 2 additions and 1 deletions

View File

@ -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