[sr-dev] git:master: modules_k/db_sqlite: fix memory leak in sqlops query

Olle E. Johansson oej at edvina.net
Wed Oct 17 21:52:30 CEST 2012


Does this patch need to go into the 3.3 branch too?

Just a kind question and possibly a reminder.. :-)

/O
17 okt 2012 kl. 08:58 skrev Timo Teras <timo.teras at iki.fi>:

> Module: sip-router
> Branch: master
> Commit: ecf95eb0ada8bfacb93af7b82f39347c841229e4
> URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ecf95eb0ada8bfacb93af7b82f39347c841229e4
> 
> Author: Timo Teräs <timo.teras at iki.fi>
> Committer: Timo Teräs <timo.teras at 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 at amper.es>
> 
> ---
> 
> 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;
> }
> 
> 
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




More information about the sr-dev mailing list