projects
/
project
/
rpcd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
uci: fix memory leak in rpc_uci_replace_savedir()
[project/rpcd.git]
/
uci.c
diff --git
a/uci.c
b/uci.c
index
49c2336
..
a1b8311
100644
(file)
--- a/
uci.c
+++ b/
uci.c
@@
-212,8
+212,12
@@
rpc_uci_replace_savedir(const char *path)
{
struct uci_element *e, *tmp;
{
struct uci_element *e, *tmp;
- uci_foreach_element_safe(&cursor->delta_path, tmp, e)
+ uci_foreach_element_safe(&cursor->delta_path, tmp, e) {
+ if (e->name)
+ free(e->name);
+
free(e);
free(e);
+ }
cursor->delta_path.prev = &cursor->delta_path;
cursor->delta_path.next = &cursor->delta_path;
cursor->delta_path.prev = &cursor->delta_path;
cursor->delta_path.next = &cursor->delta_path;
@@
-968,7
+972,7
@@
rpc_uci_order(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *cur;
struct uci_package *p = NULL;
struct uci_ptr ptr = { 0 };
struct blob_attr *cur;
struct uci_package *p = NULL;
struct uci_ptr ptr = { 0 };
- int rem, i =
1
;
+ int rem, i =
0
;
blobmsg_parse(rpc_uci_order_policy, __RPC_O_MAX, tb,
blob_data(msg), blob_len(msg));
blobmsg_parse(rpc_uci_order_policy, __RPC_O_MAX, tb,
blob_data(msg), blob_len(msg));