From: Kern Sibbald Date: Mon, 1 Feb 2010 17:52:00 +0000 (+0100) Subject: Free db_list when not used X-Git-Tag: Release-5.2.1~1813 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=acde5dc54d3a4c110da0e14919089940ccd96acb;p=bacula%2Fbacula Free db_list when not used --- 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); }