From: Kern Sibbald Date: Tue, 22 Jul 2014 12:12:32 +0000 (+0200) Subject: Fix seg fault in jobq.c X-Git-Tag: Release-7.0.5~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5cb8236d0b2e002c9898085b96d3cbee128dfcc7;p=bacula%2Fbacula Fix seg fault in jobq.c --- diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index f28c68124c..ddd33bea15 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -460,7 +460,9 @@ void *jobq_server(void *arg) if (jcr->acquired_resource_locks) { dec_read_store(jcr); dec_write_store(jcr); - jcr->client->NumConcurrentJobs--; + if (jcr->client) { + jcr->client->NumConcurrentJobs--; + } jcr->job->NumConcurrentJobs--; jcr->acquired_resource_locks = false; } @@ -772,14 +774,16 @@ static bool acquire_resources(JCR *jcr) return false; } - if (jcr->client->NumConcurrentJobs < jcr->client->MaxConcurrentJobs) { - jcr->client->NumConcurrentJobs++; - } else { - /* Back out previous locks */ - dec_write_store(jcr); - dec_read_store(jcr); - jcr->setJobStatus(JS_WaitClientRes); - return false; + if (jcr->client) { + if (jcr->client->NumConcurrentJobs < jcr->client->MaxConcurrentJobs) { + jcr->client->NumConcurrentJobs++; + } else { + /* Back out previous locks */ + dec_write_store(jcr); + dec_read_store(jcr); + jcr->setJobStatus(JS_WaitClientRes); + return false; + } } if (jcr->job->NumConcurrentJobs < jcr->job->MaxConcurrentJobs) { jcr->job->NumConcurrentJobs++; @@ -787,7 +791,9 @@ static bool acquire_resources(JCR *jcr) /* Back out previous locks */ dec_write_store(jcr); dec_read_store(jcr); - jcr->client->NumConcurrentJobs--; + if (jcr->client) { + jcr->client->NumConcurrentJobs--; + } jcr->setJobStatus(JS_WaitJobRes); return false; }