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

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 25 14:05:59 CET 2013


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Feb 25 13:58:55 2013 +0100

msilo: safety check for freeing tmp_extra_headers

- it can be a static empty buffer
- reported by Stoyan Mihaylov
- backport of 23b84739a72c5cca1fd397fbe1a7468a621cc2e6

---

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

diff --git a/modules_k/msilo/msilo.c b/modules_k/msilo/msilo.c
index 209b309..efa49f1 100644
--- a/modules_k/msilo/msilo.c
+++ b/modules_k/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