[sr-dev] git:master:10250429: dmq: do not parse From header again, since it was done already prior to cloning msg.

Charles Chance charles.chance at sipcentric.com
Fri Jan 30 15:09:31 CET 2015


Module: kamailio
Branch: master
Commit: 102504294f9edaaee9d4baea873d4ed9151b8fed
URL: https://github.com/kamailio/kamailio/commit/102504294f9edaaee9d4baea873d4ed9151b8fed

Author: Charles Chance <charles.chance at sipcentric.com>
Committer: Charles Chance <charles.chance at sipcentric.com>
Date: 2015-01-30T14:08:01Z

dmq: do not parse From header again, since it was done already prior to cloning msg.

- introduces a memory leak if not manually freed
- but there is no need to parse it again anyway
- discovered by Andrey Rybkin

---

Modified: modules/dmq/worker.c

---

Diff:  https://github.com/kamailio/kamailio/commit/102504294f9edaaee9d4baea873d4ed9151b8fed.diff
Patch: https://github.com/kamailio/kamailio/commit/102504294f9edaaee9d4baea873d4ed9151b8fed.patch

---

diff --git a/modules/dmq/worker.c b/modules/dmq/worker.c
index 8426730..ca1b3dc 100644
--- a/modules/dmq/worker.c
+++ b/modules/dmq/worker.c
@@ -91,11 +91,11 @@ void worker_loop(int id)
 			current_job = job_queue_pop(worker->queue);
 			/* job_queue_pop might return NULL if queue is empty */
 			if(current_job) {
-				/* extract the from uri */
-				if (parse_from_header(current_job->msg) < 0) {
-					LM_ERR("bad sip message or missing From hdr\n");
-				} else {
+				/* attempt to identify node based on from uri */
+				if (current_job->msg->from->parsed) {
 					dmq_node = find_dmq_node_uri(node_list, &((struct to_body*)current_job->msg->from->parsed)->uri);
+				} else {
+					LM_ERR("bad sip message or missing From hdr\n");
 				}
 
 				ret_value = current_job->f(current_job->msg, &peer_response, dmq_node);




More information about the sr-dev mailing list