diff --git a/src/core/parser/msg_parser.c b/src/core/parser/msg_parser.c index 91095bf5741..ca0bf789c5e 100644 --- a/src/core/parser/msg_parser.c +++ b/src/core/parser/msg_parser.c @@ -806,11 +806,14 @@ int set_path_vector(struct sip_msg* msg, str* path) void reset_path_vector(struct sip_msg* const msg) { - if (msg->path_vec.s) { - pkg_free(msg->path_vec.s); + if (!shm_address_in(msg->path_vec.s)) { + if (msg->path_vec.s) + pkg_free(msg->path_vec.s); + msg->path_vec.s = 0; + msg->path_vec.len = 0; + } else { + LM_WARN("Found path_vec that is not in pkg mem!\n"); } - msg->path_vec.s = 0; - msg->path_vec.len = 0; } diff --git a/src/modules/corex/corex_lib.c b/src/modules/corex/corex_lib.c index ec5334cb2e3..3d3f73c0bd6 100644 --- a/src/modules/corex/corex_lib.c +++ b/src/modules/corex/corex_lib.c @@ -63,11 +63,13 @@ int corex_append_branch(sip_msg_t *msg, str *uri, str *qv) msg->dst_uri.len = 0; /* 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) + if (!shm_address_in(msg->path_vec.s)) { + if (msg->path_vec.s) pkg_free(msg->path_vec.s); msg->path_vec.s = 0; msg->path_vec.len = 0; + } else { + LM_WARN("Found path_vec that is not in pkg mem!\n"); } }