service/service_stopped(): fix a use-after-free
authorAlexander Couzens <lynxis@fe80.eu>
Sun, 11 Jun 2017 09:49:00 +0000 (11:49 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 20 Jun 2017 14:48:43 +0000 (16:48 +0200)
Found-by: Coverity Scan #1412548
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
service/service.c

index 9675ba25eeb4b14342eb2586ef09768d08420282..fa7d4352a8d578ace32ff0140a643b618684a40d 100644 (file)
@@ -609,9 +609,9 @@ void service_stopped(struct service *s)
                service_event("service.stop", s->name, NULL);
                avl_delete(&services, &s->avl);
                trigger_del(s);
+               service_validate_del(s);
                free(s->trigger);
                free(s);
-               service_validate_del(s);
        }
 }