chiark / gitweb /
job: don't access j->type when j is already freed
authorLennart Poettering <lennart@poettering.net>
Thu, 24 Feb 2011 02:23:43 +0000 (03:23 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 24 Feb 2011 02:23:43 +0000 (03:23 +0100)
src/job.c

index 7470204710b2c3e282527a10b3a75a18145888b1..54c204b650335ec9d35be6ff5db50d1e286c2c7b 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -502,11 +502,11 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
         t = j->type;
         job_free(j);
 
-        if (result == JOB_FAILED && j->type == JOB_START)
+        if (result == JOB_FAILED && t == JOB_START)
                 unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ", see 'systemctl status %s' for details.\n", unit_description(u), u->meta.id);
-        else if (result == JOB_TIMEOUT && j->type == JOB_START)
+        else if (result == JOB_TIMEOUT && t == JOB_START)
                 unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "timed out" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u), u->meta.id);
-        else if (result == JOB_TIMEOUT && j->type == JOB_STOP)
+        else if (result == JOB_TIMEOUT && t == JOB_STOP)
                 unit_status_printf(u, "Stopping %s " ANSI_HIGHLIGHT_ON "timed out" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u), u->meta.id);
 
         /* Fail depending jobs on failure */