From 3e3163b3e6e89804bea6a33fe6243142dbcc3686 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 20 Dec 2005 15:53:31 +0000 Subject: [PATCH] Fix seg fault in acquire.c git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2695 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kes-1.38 | 3 +++ bacula/src/stored/acquire.c | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bacula/kes-1.38 b/bacula/kes-1.38 index ced0fff2fe..4fc228650b 100644 --- a/bacula/kes-1.38 +++ b/bacula/kes-1.38 @@ -5,6 +5,9 @@ General: Beta release 20Dec05: Changes to 1.38.3: +20Dec05 +- Fix seg fault in exit of acquire when canceling a job -- + reported by Wolfgang Denk 19Dec05 - Implement load balancing code. - Pull a few files from 1.39 where we can maintain compatibility. diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 16685138e8..44002603b1 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -388,16 +388,20 @@ DCR *acquire_device_for_append(DCR *dcr) if (jcr->NumVolumes == 0) { jcr->NumVolumes = 1; } - goto ok_out; + P(dev->mutex); + if (dcr->reserved_device) { + dev->reserved_device--; + Dmsg1(100, "Dec reserve=%d\n", dev->reserved_device); + dcr->reserved_device = false; + } + V(dev->mutex); + dev->unblock(); + return dcr; /* - * If we jump here, it is an error return because - * rtn_dev will still be NULL + * Error return */ get_out: - free_dcr(dcr); - dcr = NULL; -ok_out: P(dev->mutex); if (dcr->reserved_device) { dev->reserved_device--; @@ -405,8 +409,9 @@ ok_out: dcr->reserved_device = false; } V(dev->mutex); + free_dcr(dcr); dev->unblock(); - return dcr; + return NULL; } /* -- 2.39.5