From 823ba5dec836e9bc2f203d4e4f525e781ae90f68 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 4 Apr 2008 11:53:00 +0000 Subject: [PATCH] Fix possible seg fault in SD when freeing a volume entry. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6742 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/protos.h | 3 ++- bacula/src/stored/reserve.c | 8 ++++++-- bacula/src/version.h | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bacula/src/stored/protos.h b/bacula/src/stored/protos.h index 616c1d9c8d..b6aca7b9ff 100644 --- a/bacula/src/stored/protos.h +++ b/bacula/src/stored/protos.h @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -68,6 +68,7 @@ bool init_autochangers(); int autoload_device(DCR *dcr, int writing, BSOCK *dir); bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd); bool unload_autochanger(DCR *dcr, int loaded); +bool unload_dev(DCR *dcr, DEVICE *dev); char *edit_device_codes(DCR *dcr, char *omsg, const char *imsg, const char *cmd); int get_autochanger_loaded_slot(DCR *dcr); diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 131ddd12ba..51502c0d24 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -241,14 +241,18 @@ static VOLRES *new_vol_item(DCR *dcr, const char *VolumeName) static void free_vol_item(VOLRES *vol) { + DEVICE *dev = NULL; + free(vol->vol_name); if (vol->dev) { - vol->dev->vol = NULL; + dev = vol->dev; } free(vol); + if (dev) { + dev->vol = NULL; + } } - /* * Put a new Volume entry in the Volume list. This * effectively reserves the volume so that it will diff --git a/bacula/src/version.h b/bacula/src/version.h index f0bbd2f44c..e30b7c1746 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.2.9-b5" -#define BDATE "02 April 2008" -#define LSMDATE "02Apr08" +#define BDATE "04 April 2008" +#define LSMDATE "04Apr08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ -- 2.39.5