[sr-dev] git:master: nathelper: free local variable if getting anchor for contact header fails

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 21 22:00:29 CEST 2014


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Apr 21 21:49:27 2014 +0200

nathelper: free local variable if getting anchor for contact header fails

---

 modules/nathelper/nathelper.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/nathelper/nathelper.c b/modules/nathelper/nathelper.c
index c34beee..9a76550 100644
--- a/modules/nathelper/nathelper.c
+++ b/modules/nathelper/nathelper.c
@@ -906,8 +906,10 @@ set_contact_alias_f(struct sip_msg* msg, char* str1, char* str2)
 
 	offset = c->uri.s - msg->buf;
 	anchor = del_lump(msg, offset, c->uri.len, HDR_CONTACT_T);
-	if (anchor == 0)
+	if (anchor == 0) {
+		pkg_free(buf);
 		return -1;
+	}
 
 	if (insert_new_lump_after(anchor, buf, len, HDR_CONTACT_T) == 0) {
 		pkg_free(buf);
@@ -2350,6 +2352,7 @@ add_rcv_param_f(struct sip_msg* msg, char* str1, char* str2)
 		}
 		if (anchor == NULL) {
 			LM_ERR("anchor_lump failed\n");
+			pkg_free(param);
 			return -1;
 		}		
 




More information about the sr-dev mailing list