Browse code

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@amper.es>

Timo Teräs authored on 17/10/2012 06:00:14
Showing 1 changed files
... ...
@@ -543,7 +543,12 @@ int db_sqlite_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
543 543
 
544 544
 int db_sqlite_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r)
545 545
 {
546
-	return db_do_raw_query(_h, _s, _r,
546
+	int rc;
547
+
548
+	rc = db_do_raw_query(_h, _s, _r,
547 549
 			       db_sqlite_submit_query,
548 550
 			       db_sqlite_store_result);
551
+	db_sqlite_cleanup_query(_h);
552
+
553
+	return rc;
549 554
 }