aboutsummaryrefslogtreecommitdiff
path: root/tools/jpeginfo.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-12-01 08:51:48 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-12-01 08:52:10 +0100
commit5bcaf39b325c0748d2e720dfc91426b5a8c5c693 (patch)
tree09f58fad23aaa8c78129da96f58ce56679734501 /tools/jpeginfo.c
parent9c77aac640e11ca5df144e3c943f48dfeab8485a (diff)
downloadfiv-5bcaf39b325c0748d2e720dfc91426b5a8c5c693.tar.gz
fiv-5bcaf39b325c0748d2e720dfc91426b5a8c5c693.tar.xz
fiv-5bcaf39b325c0748d2e720dfc91426b5a8c5c693.zip
jpeginfo: fix a minor memory leak
Diffstat (limited to 'tools/jpeginfo.c')
-rw-r--r--tools/jpeginfo.c3
1 files changed, 2 insertions, 1 deletions
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