From 8e78ed7a7f1fa3ffd9a28d65dcc0e4eac83509d9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 1 Feb 2010 18:52:00 +0100 Subject: [PATCH] Free db_list when not used --- bacula/src/cats/dbi.c | 4 ++++ bacula/src/cats/mysql.c | 7 +++++-- bacula/src/cats/postgresql.c | 4 ++++ bacula/src/cats/sqlite.c | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bacula/src/cats/dbi.c b/bacula/src/cats/dbi.c index 0b1472b48b..311a492b78 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -376,6 +376,10 @@ db_close_database(JCR *jcr, B_DB *mdb) free(mdb->db_driver); } free(mdb); + if (db_list->size() == 0) { + delete db_list; + db_list = NULL; + } } V(mutex); } diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index c71418e449..52ee3302f5 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2010 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. @@ -32,7 +32,6 @@ * * Kern Sibbald, March 2000 * - * Version $Id$ */ @@ -272,6 +271,10 @@ db_close_database(JCR *jcr, B_DB *mdb) free(mdb->db_socket); } free(mdb); + if (db_list->size() == 0) { + delete db_list; + db_list = NULL; + } } V(mutex); } diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index 82c9b2377b..9407978d67 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -292,6 +292,10 @@ db_close_database(JCR *jcr, B_DB *mdb) free(mdb->db_socket); } free(mdb); + if (db_list->size() == 0) { + delete db_list; + db_list = NULL; + } } V(mutex); } diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 93d4196ae3..22680e2f4a 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -263,6 +263,10 @@ db_close_database(JCR *jcr, B_DB *mdb) free(mdb->db_name); } free(mdb); + if (db_list->size() == 0) { + delete db_list; + db_list = NULL; + } } V(mutex); } -- 2.39.5