[sr-dev] git:master: modules_k/sqlops: fix memory leak with string memory in sql_xquery()

Alex Hermann alex at speakup.nl
Mon Sep 5 17:10:57 CEST 2011


Module: sip-router
Branch: master
Commit: 5105633118009caebf92a35bd23bf2f7cf53548b
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5105633118009caebf92a35bd23bf2f7cf53548b

Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date:   Mon Sep  5 17:08:18 2011 +0200

modules_k/sqlops: fix memory leak with string memory in sql_xquery()

---

 modules_k/sqlops/sql_api.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/modules_k/sqlops/sql_api.c b/modules_k/sqlops/sql_api.c
index d1a4f63..cc0f090 100644
--- a/modules_k/sqlops/sql_api.c
+++ b/modules_k/sqlops/sql_api.c
@@ -522,6 +522,8 @@ int sql_do_xquery(struct sip_msg *msg, sql_con_t *con, pv_elem_t *query,
 			/* Add column to current row, under the column's name */
 			LM_DBG("Adding column: %.*s\n", RES_NAMES(db_res)[j]->len, RES_NAMES(db_res)[j]->s);
 			xavp_add_value(RES_NAMES(db_res)[j], &val, &row);
+			if (val.type == SR_XTYPE_STR && val.v.s.len > 0)
+				pkg_free(val.v.s.s);
 		}
 		/* Add row to result xavp */
 		val.type = SR_XTYPE_XAVP;




More information about the sr-dev mailing list