summaryrefslogtreecommitdiffhomepage
path: root/main.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-20 20:47:48 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-20 20:47:48 +0200
commit4410e14919de62ca8af35194b8a1ecfe74c5c624 (patch)
treee0981c68093e870703af54307e0ef851f732aec4 /main.c
parent9a74b811f007986a3e6015af0c06b33147d05951 (diff)
main: fix memory leak with -e option
Release the parsed intermediate object after copying its values into the global env object. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.c b/main.c
index 0ce2a7d..f80f80b 100644
--- a/main.c
+++ b/main.c
@@ -321,7 +321,9 @@ main(int argc, char **argv)
env = env ? env : json_object_new_object();
json_object_object_foreach(o, key, val)
- json_object_object_add(env, key, val);
+ json_object_object_add(env, key, json_object_get(val));
+
+ json_object_put(o);
break;