From f4860708e2d635862b6e198b61b6904c3e696b23 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/ingres.c | 4 ++++ bacula/src/cats/mysql.c | 7 +++++-- bacula/src/cats/postgresql.c | 4 ++++ bacula/src/cats/sqlite.c | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/bacula/src/cats/dbi.c b/bacula/src/cats/dbi.c index 16e7546bd4..11f4003329 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -372,6 +372,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/ingres.c b/bacula/src/cats/ingres.c index 5a9291847e..4cf709b26e 100755 --- a/bacula/src/cats/ingres.c +++ b/bacula/src/cats/ingres.c @@ -273,6 +273,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/mysql.c b/bacula/src/cats/mysql.c index 994e0e5485..a2a355b214 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$ */ @@ -269,6 +268,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 c5757efced..c0d52cb2e6 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -290,6 +290,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 d18b24e891..2e07ace931 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -261,6 +261,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