Skip to content

Commit

Permalink
Freed memory on SQL engine termination
Browse files Browse the repository at this point in the history
Modified mdb_sql_exit to free the memory allocated for the SQL engine in mdb_sql_init
  • Loading branch information
rogerswb committed May 24, 2015
1 parent d0472d9 commit 4148518
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/sql/mdbsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 4148518

Please sign in to comment.