ubus: Fix memleak in examples/client in case of failure
authorHans Dedecker <dedeckeh@gmail.com>
Tue, 28 Apr 2015 14:07:28 +0000 (16:07 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 8 May 2015 10:06:39 +0000 (12:06 +0200)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
examples/client.c

index 952ab54..7ef5663 100644 (file)
@@ -118,6 +118,7 @@ static void test_count(struct uloop_timeout *timeout)
        blobmsg_add_string(&b, "string", s);
 
        if (ubus_lookup_id(ctx, "test", &id)) {
        blobmsg_add_string(&b, "string", s);
 
        if (ubus_lookup_id(ctx, "test", &id)) {
+               free(s);
                fprintf(stderr, "Failed to look up test object\n");
                return;
        }
                fprintf(stderr, "Failed to look up test object\n");
                return;
        }