]> git.sur5r.net Git - bacula/bacula/commitdiff
Eliminate important memory loss in SQLite
authorKern Sibbald <kern@sibbald.com>
Sun, 13 May 2007 20:21:35 +0000 (20:21 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 13 May 2007 20:21:35 +0000 (20:21 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4773 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/scripts/devel_bacula.in
bacula/src/cats/sqlite.c
bacula/technotes-2.1

index 9b833bb1fa08cc8dc447243e564853c846e51cf7..bddb7705eeb7525130651ce6ba3776d062fb4064 100755 (executable)
@@ -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
        }
        ;;
index 642af3815c027811cee9a1c2a344c9e530ad0e70..ac6b2e62e2cc9e1d605262e452d47cdfbb06832a 100644 (file)
@@ -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;
 }
 
index bb55ab07c264ed4a151c30bf86d61625df593b4b..70eeb1eabc77b4f7524b95fcab8d87fdba6d45e4 100644 (file)
@@ -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.