service: fix trigger related double-free
authorFelix Fietkau <nbd@openwrt.org>
Wed, 2 Jul 2014 19:04:52 +0000 (21:04 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 2 Jul 2014 19:04:53 +0000 (21:04 +0200)
The memdup is unnecessary, because the data is contained inside
in->config.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
service/instance.c

index 1f859140dc94a9100438f86a3512d87cacfb9616..2e2f4130294a07243347bea90a1251ac351fb832 100644 (file)
@@ -431,9 +431,7 @@ instance_config_parse(struct service_instance *in)
                in->respawn_retry = vals[2];
        }
        if (tb[INSTANCE_ATTR_TRIGGER]) {
-               in->trigger = blob_memdup(tb[INSTANCE_ATTR_TRIGGER]);
-               if (!in->trigger)
-                       return -1;
+               in->trigger = tb[INSTANCE_ATTR_TRIGGER];
                trigger_add(in->trigger, in);
        }
 
@@ -531,7 +529,6 @@ instance_free(struct service_instance *in)
        uloop_timeout_cancel(&in->timeout);
        trigger_del(in);
        watch_del(in);
-       free(in->trigger);
        instance_config_cleanup(in);
        free(in->config);
        free(in);