From 619f3a160de4f417226b69039538882787b3811c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 26 Jan 2016 10:10:39 +0100 Subject: [PATCH] ubusd: fix a memory leak on user/group client info Signed-off-by: Felix Fietkau --- ubusd_acl.c | 7 +++++++ ubusd_acl.h | 1 + ubusd_proto.c | 1 + 3 files changed, 9 insertions(+) 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); } -- 2.25.1