summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-26 10:10:39 +0100
committerFelix Fietkau <nbd@openwrt.org>2016-01-26 10:10:39 +0100
commit619f3a160de4f417226b69039538882787b3811c (patch)
tree6264896bcb9017269245005ba632d22fe6a3ba30
parent8bb34756ce2bd684745d3a49a134dae03073b452 (diff)
downloadubus-619f3a160de4f417226b69039538882787b3811c.tar.gz
ubusd: fix a memory leak on user/group client info
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--ubusd_acl.c7
-rw-r--r--ubusd_acl.h1
-rw-r--r--ubusd_proto.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/ubusd_acl.c b/ubusd_acl.c
index 15a58d8..85ada5d 100644
--- a/ubusd_acl.c
+++ b/ubusd_acl.c
@@ -174,6 +174,13 @@ ubusd_acl_init_client(struct ubus_client *cl, int fd)
return 0;
}
+void
+ubusd_acl_free_client(struct ubus_client *cl)
+{
+ free(cl->group);
+ free(cl->user);
+}
+
static void
ubusd_acl_file_free(struct ubusd_acl_file *file)
{
diff --git a/ubusd_acl.h b/ubusd_acl.h
index 8464a01..c5dfd8a 100644
--- a/ubusd_acl.h
+++ b/ubusd_acl.h
@@ -22,6 +22,7 @@ enum ubusd_acl_type {
int ubusd_acl_check(struct ubus_client *cl, const char *obj, const char *method, enum ubusd_acl_type type);
int ubusd_acl_init_client(struct ubus_client *cl, int fd);
+void ubusd_acl_free_client(struct ubus_client *cl);
void ubusd_acl_load(void);
#endif
diff --git a/ubusd_proto.c b/ubusd_proto.c
index baf3eb6..0af11f2 100644
--- a/ubusd_proto.c
+++ b/ubusd_proto.c
@@ -500,6 +500,7 @@ void ubusd_proto_free_client(struct ubus_client *cl)
ubusd_free_object(obj);
}
+ ubusd_acl_free_client(cl);
ubus_free_id(&clients, &cl->id);
}