Module: sip-router
Branch: 3.3
Commit: 8198f2dcc92127bc15ac13f71372f016b8c982d9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8198f2d…
Author: Timo Teräs <timo.teras(a)iki.fi>
Committer: Timo Teräs <timo.teras(a)iki.fi>
Date: Wed Oct 17 09:00:14 2012 +0300
modules_k/db_sqlite: fix memory leak in sqlops query
Seems that most other database drivers release the database
resource only at free_result time, which I some how missed.
Since we are doing a deep copy in store_result(), we can
just release the sqlite resources immediately raw_query().
Reported-by: Pedro Antonio Vico Solano <pvsolano(a)amper.es>
(cherry picked from commit ecf95eb0ada8bfacb93af7b82f39347c841229e4)
---
modules_k/db_sqlite/dbase.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/modules_k/db_sqlite/dbase.c b/modules_k/db_sqlite/dbase.c
index 0b32e07..c1d3b71 100644
--- a/modules_k/db_sqlite/dbase.c
+++ b/modules_k/db_sqlite/dbase.c
@@ -543,7 +543,12 @@ int db_sqlite_update(const db1_con_t* _h, const db_key_t* _k, const
db_op_t* _o,
int db_sqlite_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r)
{
- return db_do_raw_query(_h, _s, _r,
+ int rc;
+
+ rc = db_do_raw_query(_h, _s, _r,
db_sqlite_submit_query,
db_sqlite_store_result);
+ db_sqlite_cleanup_query(_h);
+
+ return rc;
}