Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corex: check not in SHM before PKG free for path #2237

Merged
merged 1 commit into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/core/parser/msg_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
6 changes: 4 additions & 2 deletions src/modules/corex/corex_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down