From ff8da369e3ee04965206b69744d9b2bc4ada5835 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 13 May 2007 20:21:35 +0000 Subject: [PATCH] Eliminate important memory loss in SQLite git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4773 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/scripts/devel_bacula.in | 1 + bacula/src/cats/sqlite.c | 6 +++++- bacula/technotes-2.1 | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bacula/scripts/devel_bacula.in b/bacula/scripts/devel_bacula.in index 9b833bb1fa..bddb7705ee 100755 --- a/bacula/scripts/devel_bacula.in +++ b/bacula/scripts/devel_bacula.in @@ -230,6 +230,7 @@ case "$1" in OPTIONS="${OPTIONS} -g ${DIR_GROUP}" fi +# valgrind --leak-check=full ${BACDIRBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACDIRCFG}/dird.conf ${BACDIRBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACDIRCFG}/dird.conf } ;; diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 642af3815c..ac6b2e62e2 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -387,6 +387,7 @@ int my_sqlite_query(B_DB *mdb, const char *cmd) { int stat; + my_sqlite_free_table(mdb); if (mdb->sqlite_errmsg) { #ifdef HAVE_SQLITE3 sqlite3_free(mdb->sqlite_errmsg); @@ -422,7 +423,10 @@ void my_sqlite_free_table(B_DB *mdb) free(mdb->fields); mdb->fields_defined = false; } - sqlite_free_table(mdb->result); + if (mdb->result) { + sqlite_free_table(mdb->result); + mdb->result = NULL; + } mdb->nrow = mdb->ncolumn = 0; } diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index bb55ab07c2..70eeb1eabc 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,6 +2,7 @@ General: 13May07 +kes Eliminate important memory loss in SQLite kes Fixed the batch insert MySQL thread specific data that was not being freed. See cats/mysql.c:db_thread_cleanup(). kes Fix restore before command. -- 2.39.5