Module: sip-router
Branch: 4.1
Commit: 01c5ad7cb67bdb5d6140061aa0c2f8152f6f03cd
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=01c5ad7…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Charles Chance <charles.chance(a)sipcentric.com>
Date: Fri Feb 14 10:21:00 2014 +0000
dmq: fixed crash caused by freeing pointer too early on tm callback
(cherry picked from commit 8be7de6d1d383c2e0e476e739a6b3fa5101bac12)
---
modules/dmq/dmqnode.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/dmq/dmqnode.c b/modules/dmq/dmqnode.c
index bc7c108..cf1d9db 100644
--- a/modules/dmq/dmqnode.c
+++ b/modules/dmq/dmqnode.c
@@ -228,8 +228,12 @@ dmq_node_t* find_dmq_node_uri(dmq_node_list_t* list, str* uri)
void destroy_dmq_node(dmq_node_t* node, int shm)
{
if(shm) {
+ if (node->params!=NULL)
+ shm_free_params(node->params);
shm_free_node(node);
} else {
+ if (node->params!=NULL)
+ free_params(node->params);
pkg_free_node(node);
}
}
@@ -283,8 +287,6 @@ void shm_free_node(dmq_node_t* node)
{
if (node->orig_uri.s!=NULL)
shm_free(node->orig_uri.s);
- if (node->params!=NULL)
- shm_free_params(node->params);
shm_free(node);
}
@@ -295,8 +297,6 @@ void pkg_free_node(dmq_node_t* node)
{
if (node->orig_uri.s!=NULL)
pkg_free(node->orig_uri.s);
- if (node->params!=NULL)
- free_params(node->params);
pkg_free(node);
}
@@ -312,7 +312,7 @@ int del_dmq_node(dmq_node_list_t* list, dmq_node_t* node)
while(cur) {
if(cmp_dmq_node(cur, node)) {
*prev = cur->next;
- shm_free_node(cur);
+ destroy_dmq_node(cur, 1);
lock_release(&list->lock);
return 1;
}