[sr-dev] git:master:7987122d: textopsx: free in case of error inside sel_hf_value_name()

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 7 09:54:44 CEST 2017


Module: kamailio
Branch: master
Commit: 7987122d25003dd4b5f0ce47caf3e5c9811917b3
URL: https://github.com/kamailio/kamailio/commit/7987122d25003dd4b5f0ce47caf3e5c9811917b3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-07T09:29:41+02:00

textopsx: free in case of error inside sel_hf_value_name()

---

Modified: src/modules/textopsx/textopsx.c

---

Diff:  https://github.com/kamailio/kamailio/commit/7987122d25003dd4b5f0ce47caf3e5c9811917b3.diff
Patch: https://github.com/kamailio/kamailio/commit/7987122d25003dd4b5f0ce47caf3e5c9811917b3.patch

---

diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c
index 7f99a394f4..d7a948c8ea 100644
--- a/src/modules/textopsx/textopsx.c
+++ b/src/modules/textopsx/textopsx.c
@@ -370,7 +370,10 @@ static int keep_hf_helper(sip_msg_t *msg, regex_t *re)
 	struct lump *l;
 
 	/* we need to be sure we have seen all HFs */
-	parse_headers(msg, HDR_EOH_F, 0);
+	if(parse_headers(msg, HDR_EOH_F, 0) == -1) {
+		LM_ERR("Error while parsing message\n");
+		return -1;
+	}
 	for(hf = msg->headers; hf; hf = hf->next) {
 		switch(hf->type) {
 			case HDR_FROM_T:
@@ -1723,8 +1726,10 @@ static int sel_hf_value_name(str *res, select_t *s, struct sip_msg *msg)
 			hname->hname = s->params[1].v.s;
 			parse_hname2(buf, buf + i, &hdr);
 
-			if(hdr.type == HDR_ERROR_T)
+			if(hdr.type == HDR_ERROR_T) {
+				pkg_free(hname);
 				return E_CFG;
+			}
 			hname->htype = hdr.type;
 
 			s->params[1].v.p = hname;




More information about the sr-dev mailing list