Module: sip-router
Branch: master
Commit: 99d50e2da0753d7482ed2884e665e08e235daf5e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=99d50e2…
Author: Jason Penton <jason.penton(a)gmail.com>
Committer: Jason Penton <jason.penton(a)gmail.com>
Date: Mon Mar 10 19:49:39 2014 +0200
modules/corex: corrected freeing of msg. w.r.t path vecor
- now use FL_SHM_CLONE internal msg flag to decide whether or not to pkg free
path_vec
---
modules/corex/corex_lib.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/corex/corex_lib.c b/modules/corex/corex_lib.c
index f83352b..23c9a8c 100644
--- a/modules/corex/corex_lib.c
+++ b/modules/corex/corex_lib.c
@@ -83,11 +83,14 @@ int corex_append_branch(sip_msg_t *msg, gparam_t *pu, gparam_t *pq)
pkg_free(msg->dst_uri.s);
msg->dst_uri.s = 0;
msg->dst_uri.len = 0;
- if(msg->path_vec.s!=0)
- if (likely(msg->path_vec.s >= msg->buf && (msg->path_vec.s <
(msg->buf + msg->len))))
+
+ /* if this is a cloned message, don't free the path vector as it was copied into
shm memory and will be freed as contiguous block*/
+ if (!(msg->msg_flags&FL_SHM_CLONE)) {
+ if(msg->path_vec.s!=0)
pkg_free(msg->path_vec.s);
- msg->path_vec.s = 0;
- msg->path_vec.len = 0;
+ msg->path_vec.s = 0;
+ msg->path_vec.len = 0;
+ }
}
return ret;