From: Simon McVittie Date: Tue, 29 Nov 2016 00:48:14 +0000 (+0000) Subject: activation test: don't crash if AppArmor is built but unavailable X-Git-Tag: dbus-1.12.0~301 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca2cdab866ad6ef94a477bde6497dbf8deb3aeef;p=platform%2Fupstream%2Fdbus.git activation test: don't crash if AppArmor is built but unavailable Also don't try to clean up a process we didn't start. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98666 Signed-off-by: Simon McVittie Reviewed-by: Philip Withnall --- diff --git a/test/sd-activation.c b/test/sd-activation.c index 058a247..da63f7d 100644 --- a/test/sd-activation.c +++ b/test/sd-activation.c @@ -801,9 +801,15 @@ teardown (Fixture *f, f->activated = NULL; } - test_kill_pid (f->daemon_pid); - g_spawn_close_pid (f->daemon_pid); - test_main_context_unref (f->ctx); + if (f->daemon_pid != 0) + { + test_kill_pid (f->daemon_pid); + g_spawn_close_pid (f->daemon_pid); + } + + if (f->ctx != NULL) + test_main_context_unref (f->ctx); + g_free (f->address); }