Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6476:af14dc005392 HEAD
Let deinit() free all the memory itself after all.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 22 Sep 2007 19:19:13 +0300 |
parents | ee420f238104 |
children | 15874cb050e2 |
files | src/lib-sql/driver-mysql.c src/lib-sql/driver-pgsql.c src/lib-sql/driver-sqlite.c src/lib-sql/sql-api.c |
diffstat | 4 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-sql/driver-mysql.c Sat Sep 22 19:03:33 2007 +0300 +++ b/src/lib-sql/driver-mysql.c Sat Sep 22 19:19:13 2007 +0300 @@ -245,9 +245,11 @@ static struct sql_db *driver_mysql_init_v(const char *connect_string) { struct mysql_db *db; + pool_t pool; - db = i_new(struct mysql_db, 1); - db->pool = pool_alloconly_create("mysql driver", 512);; + pool = pool_alloconly_create("mysql driver", 512); + db = p_new(pool, struct mysql_db, 1); + db->pool = pool; db->api = driver_mysql_db; p_array_init(&db->connections, db->pool, 6); @@ -265,6 +267,7 @@ for (i = 0; i < count; i++) (void)driver_mysql_connection_free(&conn[i]); + array_free(&_db->module_contexts); pool_unref(&db->pool); }
--- a/src/lib-sql/driver-pgsql.c Sat Sep 22 19:03:33 2007 +0300 +++ b/src/lib-sql/driver-pgsql.c Sat Sep 22 19:19:13 2007 +0300 @@ -213,6 +213,8 @@ driver_pgsql_close(db); i_free(db->error); i_free(db->connect_string); + array_free(&_db->module_contexts); + i_free(db); } static enum sql_db_flags
--- a/src/lib-sql/driver-sqlite.c Sat Sep 22 19:03:33 2007 +0300 +++ b/src/lib-sql/driver-sqlite.c Sat Sep 22 19:19:13 2007 +0300 @@ -1,6 +1,7 @@ /* Copyright (C) 2006 Jakob Hirsch */ #include "lib.h" +#include "array.h" #include "str.h" #include "sql-api-private.h" @@ -60,11 +61,13 @@ static struct sql_db *driver_sqlite_init_v(const char *connect_string) { struct sqlite_db *db; + pool_t pool; i_assert(connect_string != NULL); - db = i_new(struct sqlite_db, 1); - db->pool = pool_alloconly_create("sqlite driver", 512);; + pool = pool_alloconly_create("sqlite driver", 512); + db = p_new(pool, struct sqlite_db, 1); + db->pool = pool; db->api = driver_sqlite_db; db->dbfile = p_strdup(db->pool, connect_string); db->connected = FALSE; @@ -77,6 +80,7 @@ struct sqlite_db *db = (struct sqlite_db *)_db; sqlite3_close(db->sqlite); + array_free(&_db->module_contexts); pool_unref(&db->pool); }