service/service_stopped(): fix a use-after-free
authorAlexander Couzens <lynxis@fe80.eu>
Sun, 11 Jun 2017 09:49:00 +0000 (11:49 +0200)
committerAlexander Couzens <lynxis@fe80.eu>
Sun, 11 Jun 2017 11:48:34 +0000 (13:48 +0200)
Found-by: Coverity Scan #1412548
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
service/service.c

index 6ba0c1741daba8872c221d69fb23452c3eb901fa..72e269da3bad4105d488433409131e1b1bb4b5d2 100644 (file)
@@ -666,9 +666,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);
        }
 }