[sr-dev] git:master: msilo: safety check for freeing tmp_extra_headers

Daniel-Constantin Mierla miconda at gmail.com
Wed Feb 6 23:09:14 CET 2013


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Feb  6 23:08:02 2013 +0100

msilo: safety check for freeing tmp_extra_headers

- it can be a static empty buffer
- reported by Stoyan Mihaylov

---

 modules/msilo/msilo.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/msilo/msilo.c b/modules/msilo/msilo.c
index 209b309..efa49f1 100644
--- a/modules/msilo/msilo.c
+++ b/modules/msilo/msilo.c
@@ -1134,13 +1134,15 @@ static int m_dump(struct sip_msg* msg, str* owner_s)
 				   tmp_extra_hdrs /*extra_hdrs*/) < 0)
 		{
 			LM_ERR("headers building failed [%d]\n", mid);
-			pkg_free(tmp_extra_hdrs.s);
+			if(tmp_extra_hdrs.len>0)
+				pkg_free(tmp_extra_hdrs.s);
 			if (msilo_dbf.free_result(db_con, db_res) < 0)
 				LM_ERR("failed to free the query result\n");
 			msg_list_set_flag(ml, mid, MS_MSG_ERRO);
 			goto error;
 		}
-		pkg_free(tmp_extra_hdrs.s);
+		if(tmp_extra_hdrs.len>0)
+			pkg_free(tmp_extra_hdrs.s);
 			
 		LM_DBG("msg [%d-%d] for: %.*s\n", i+1, mid,	pto->uri.len, pto->uri.s);
 			




More information about the sr-dev mailing list