]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix seg fault in acquire.c
authorKern Sibbald <kern@sibbald.com>
Tue, 20 Dec 2005 15:53:31 +0000 (15:53 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 20 Dec 2005 15:53:31 +0000 (15:53 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2695 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kes-1.38
bacula/src/stored/acquire.c

index ced0fff2fefa9a7f765476f3dbe2f05fc24630a9..4fc228650b3d2293b32529362e6d738306fba7a2 100644 (file)
@@ -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.
index 16685138e8b9e2773dcb08e03777a341175f8400..44002603b19bb015dc99a04b39e168368d10c87b 100644 (file)
@@ -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;
 }
 
 /*