Hmm, you may have a point - working backwards, we only call parse_headers(msg, HDR_EOH_F, 0) - which does not include From header, right?

On 30 January 2015 at 15:00, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
parse_from_header() should do nothing if the From header is found parsed. I am not sure if this alone is solving the issue properly. Maybe the From was not parsed in the first place, before cloning...

Cheers,
Daniel

On Fri, Jan 30, 2015 at 3:09 PM, Charles Chance <charles.chance@sipcentric.com> wrote:
Module: kamailio
Branch: master
Commit: 102504294f9edaaee9d4baea873d4ed9151b8fed
URL: https://github.com/kamailio/kamailio/commit/102504294f9edaaee9d4baea873d4ed9151b8fed

Author: Charles Chance <charles.chance@sipcentric.com>
Committer: Charles Chance <charles.chance@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);


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev



--

_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




--
Charles Chance
Managing Director


t. 0121 285 4400    m. 07932 063 891

www.sipcentric.com

Follow us on twitter @sipcentric

Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB.