uci: free configs list memory on return

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
[fix whitespace]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Yousong Zhou 2019-10-21 06:10:29 +00:00 committed by Jo-Philipp Wich
parent 32fba361d5
commit 9ecfada16d

4
uci.c
View file

@ -1286,6 +1286,8 @@ rpc_uci_changes(struct ubus_context *ctx, struct ubus_object *obj,
uci_unload(cursor, p);
}
free(configs);
blobmsg_close_table(&buf, c);
ubus_send_reply(ctx, req, buf.head);
@ -1390,6 +1392,8 @@ rpc_uci_configs(struct ubus_context *ctx, struct ubus_object *obj,
for (i = 0; configs[i]; i++)
blobmsg_add_string(&buf, NULL, configs[i]);
free(configs);
blobmsg_close_array(&buf, c);
ubus_send_reply(ctx, req, buf.head);