Module: kamailio
Branch: 5.0
Commit: 79d10d03049bf235c302b5261c2a59d64f9ba210
URL:
https://github.com/kamailio/kamailio/commit/79d10d03049bf235c302b5261c2a59d…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: 2017-04-21T12:01:35-04:00
sqlops: free the result only if there is a result
(cherry picked from commit 92c8c66e5ba1e5036fdc7a6171e013e21964a03b)
---
Modified: src/modules/sqlops/sql_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/79d10d03049bf235c302b5261c2a59d…
Patch:
https://github.com/kamailio/kamailio/commit/79d10d03049bf235c302b5261c2a59d…
---
diff --git a/src/modules/sqlops/sql_api.c b/src/modules/sqlops/sql_api.c
index 30264e5..ddf579c 100644
--- a/src/modules/sqlops/sql_api.c
+++ b/src/modules/sqlops/sql_api.c
@@ -269,7 +269,7 @@ int sql_do_query(sql_con_t *con, str *query, sql_result_t *res)
if(db_res==NULL || RES_ROW_N(db_res)<=0 || RES_COL_N(db_res)<=0)
{
LM_DBG("no result after query\n");
- con->dbf.free_result(con->dbh, db_res);
+ if (db_res) con->dbf.free_result(con->dbh, db_res);
return 2;
}
if(!res)