From 414851890661125cb6beed2fdfffa2dc8dad1aa1 Mon Sep 17 00:00:00 2001 From: William Rogers Date: Sun, 24 May 2015 18:04:14 -0500 Subject: [PATCH] Freed memory on SQL engine termination Modified mdb_sql_exit to free the memory allocated for the SQL engine in mdb_sql_init --- src/sql/mdbsql.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sql/mdbsql.c b/src/sql/mdbsql.c index 96a19e4..7f7d1a4 100644 --- a/src/sql/mdbsql.c +++ b/src/sql/mdbsql.c @@ -457,9 +457,18 @@ void mdb_sql_dump(MdbSQL *sql) } void mdb_sql_exit(MdbSQL *sql) { - mdb_sql_reset(sql); // Free memory + /* Free the memory associated with the SQL engine */ + mdb_sql_reset(sql); + + g_ptr_array_free(sql->columns, TRUE); + g_ptr_array_free(sql->tables, TRUE); + + /* If libmdb has been initialized, terminate it */ if (sql->mdb) mdb_close(sql->mdb); + + /* Cleanup the SQL engine object */ + g_free(sql); } void mdb_sql_reset(MdbSQL *sql) {