diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-10-02 21:03:43 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-10-02 21:03:43 +0200 |
commit | 00c2c35a7204a41ce8d76ee80dc877746a87af5d (patch) | |
tree | 46b6294eab018f770d1ebe6fe79f5c53ea96927d /lib | |
parent | b63acee35b7e284ca1df23295d18a9aa132db120 (diff) |
uci: fix some memory leaks in ut_uci_foreach()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/uci.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -938,8 +938,11 @@ ut_uci_foreach(struct ut_state *s, uint32_t off, struct json_object *args) rv = ops->invoke(s, off, NULL, func, fnargs); /* forward exceptions from callback function */ - if (ut_is_type(rv, T_EXCEPTION)) + if (ut_is_type(rv, T_EXCEPTION)) { + json_object_put(fnargs); + return rv; + } ret = true; stop = (json_object_is_type(rv, json_type_boolean) && !json_object_get_boolean(rv)); @@ -950,6 +953,8 @@ ut_uci_foreach(struct ut_state *s, uint32_t off, struct json_object *args) break; } + json_object_put(fnargs); + return json_object_new_boolean(ret); } |