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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Wed Sep  4 22:59:13 2013 +0200

registrar: reset r-uri pointer after backup in lookup_branches()

- otherwise can be invalidated by next branch lookup

(cherry picked from commit 9b44e4b48862947f2ea634c6dd611ce7c07546a2)

---

 modules/registrar/lookup.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/modules/registrar/lookup.c b/modules/registrar/lookup.c
index fcb6c26..f9bbad3 100644
--- a/modules/registrar/lookup.c
+++ b/modules/registrar/lookup.c
@@ -400,6 +400,11 @@ int lookup_branches(sip_msg_t *msg, udomain_t *d)
        ruri_b_instance = msg->instance;
        ruri_b_reg_id = msg->reg_id;
        reset_ruri_branch(msg);
+       /* set new uri buf to null, otherwise is freed or overwritten by
+        * rewrite_uri() during branch lookup */
+       msg->new_uri.len=0;
+       msg->new_uri.s=0;
+       msg->parsed_uri_ok=0;
 
        for(i=0; i<nr_branches_start; i++) {
                crt = get_sip_branch(i);
@@ -469,7 +474,11 @@ int lookup_branches(sip_msg_t *msg, udomain_t *d)
 
 done:
        reset_ruri_branch(msg);
+       /* new uri could be set to allocated buffer by branch lookup */
+       if(msg->new_uri.s!=NULL)
+               pkg_free(msg->new_uri.s);
        msg->new_uri = ruri_b_uri;
+       ruri_mark_new();
        msg->parsed_uri_ok = 0;
        msg->dst_uri = ruri_b_dst_uri;
        msg->path_vec = ruri_b_path;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to