ubusd: fix a memory leak on user/group client info
authorFelix Fietkau <nbd@openwrt.org>
Tue, 26 Jan 2016 09:10:39 +0000 (10:10 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 26 Jan 2016 09:10:39 +0000 (10:10 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ubusd_acl.c
ubusd_acl.h
ubusd_proto.c

index 15a58d8..85ada5d 100644 (file)
@@ -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)
 {
index 8464a01..c5dfd8a 100644 (file)
@@ -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
index baf3eb6..0af11f2 100644 (file)
@@ -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);
 }