Module: sip-router
Branch: 3.2
Commit: 98197e56b283e24570eb71d7418b5ec6491cef62
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=98197e56b283e24570eb71d7418b5ec6491cef62

Author: Timo Teräs <[email protected]>
Committer: Timo Teräs <[email protected]>
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 <[email protected]>
(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 67db13b..d5dc058 100644
--- a/modules_k/db_sqlite/dbase.c
+++ b/modules_k/db_sqlite/dbase.c
@@ -520,7 +520,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;
 }


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to