Hi Daniel,
I'm sending you some memory leak fix we have found and fixed on
modules/utils/xcap_ auth.c.
The fixed memory leak is in pres_watcher_allowed (), and it is about
the "xmlFreeDoc" that it's never called for the "xcap_tree" variable.
We downloaded the source file from master branch and then we fixed it.
You can find here the diff from original and new code and in attach
both the original and the new files.
diff -u a/modules/utils/xcap_auth.c b/modules/utils/xcap_auth.c
--- a/modules/utils/xcap_auth.c
+++ b/modules/utils/xcap_auth.c
@@ -280,13 +280,15 @@
}
node= get_rule_node(subs, xcap_tree);
- if (node== NULL)
+ if (node== NULL){
+ xmlFreeDoc(xcap_tree);
return 0;
-
+ }
/* process actions */
actions_node = xmlNodeGetChildByName(node, "actions");
if (actions_node == NULL) {
LM_DBG("actions_node NULL\n");
+ xmlFreeDoc(xcap_tree);
return 0;
}
LM_DBG("actions_node->name= %s\n", actions_node->name);
@@ -294,6 +296,7 @@
sub_handling_node = xmlNodeGetChildByName(actions_node, "sub-handling");
if (sub_handling_node== NULL) {
LM_DBG("sub_handling_node NULL\n");
+ xmlFreeDoc(xcap_tree);
return 0;
}
sub_handling = (char*)xmlNodeGetContent(sub_handling_node);
@@ -302,6 +305,7 @@
if (sub_handling == NULL) {
LM_ERR("Couldn't get sub-handling content\n");
+ xmlFreeDoc(xcap_tree);
return -1;
}
if (strncmp((char*)sub_handling, "block", 5) == 0) {
@@ -325,10 +329,12 @@
else {
LM_ERR("unknown subscription handling action\n");
xmlFree(sub_handling);
+ xmlFreeDoc(xcap_tree);
return -1;
}
xmlFree(sub_handling);
+ xmlFreeDoc(xcap_tree);
return 0;
Kind Regards,
laura
Module: sip-router
Branch: 3.2
Commit: 28a5c122372d9c15d9db1514d3921a98edf9eee6
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=28a5c12…
Author: pd <peter.dunkley(a)crocodile-rcs.com>
Committer: pd <peter.dunkley(a)crocodile-rcs.com>
Date: Mon Jan 30 11:28:59 2012 +0000
modules_k/pua: Fixed occasional seg fault in PUA
- This was added by the fix to the race hazards
(Commit ID: e627bc31776b521a1078b2a004e8ed179521cae2)
- It only happens in certain error situations (which should not occur anyway -
these are under investigation now) and was found during an over-weekend
soak test.
- Found and fixed by Paul Pankhurst @ Crocodile RCS
(cherry picked from commit 6d30bd740303677711de437c4a3fec15da7344a8)
---
modules_k/pua/send_subscribe.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules_k/pua/send_subscribe.c b/modules_k/pua/send_subscribe.c
index c4caad1..86c651d 100644
--- a/modules_k/pua/send_subscribe.c
+++ b/modules_k/pua/send_subscribe.c
@@ -627,8 +627,11 @@ done:
goto end;
error:
- if (presentity->remote_contact.s) shm_free(presentity->remote_contact.s);
- if (presentity) shm_free(presentity);
+ if (presentity)
+ {
+ if (presentity->remote_contact.s) shm_free(presentity->remote_contact.s);
+ shm_free(presentity);
+ }
end:
if(hentity)
Module: sip-router
Branch: master
Commit: 6d30bd740303677711de437c4a3fec15da7344a8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6d30bd7…
Author: pd <peter.dunkley(a)crocodile-rcs.com>
Committer: pd <peter.dunkley(a)crocodile-rcs.com>
Date: Mon Jan 30 11:28:59 2012 +0000
modules_k/pua: Fixed occasional seg fault in PUA
- This was added by the fix to the race hazards
(Commit ID: e627bc31776b521a1078b2a004e8ed179521cae2)
- It only happens in certain error situations (which should not occur anyway -
these are under investigation now) and was found during an over-weekend
soak test.
- Found and fixed by Paul Pankhurst @ Crocodile RCS
---
modules_k/pua/send_subscribe.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules_k/pua/send_subscribe.c b/modules_k/pua/send_subscribe.c
index 7c25bc7..396ac90 100644
--- a/modules_k/pua/send_subscribe.c
+++ b/modules_k/pua/send_subscribe.c
@@ -696,8 +696,11 @@ done:
goto end;
error:
- if (presentity->remote_contact.s) shm_free(presentity->remote_contact.s);
- if (presentity) shm_free(presentity);
+ if (presentity)
+ {
+ if (presentity->remote_contact.s) shm_free(presentity->remote_contact.s);
+ shm_free(presentity);
+ }
end:
Module: sip-router
Branch: master
Commit: 65f41ac654fd3a7251673253867a5aa33b4fb758
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=65f41ac…
Author: pd <peter.dunkley(a)crocodile-rcs.com>
Committer: pd <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Jan 27 16:07:18 2012 +0000
modules_k/pua: Wrong type in local variable
- I used an int when I should heve used an unsigned int
---
modules_k/pua/hash.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules_k/pua/hash.c b/modules_k/pua/hash.c
index 120ca78..93e322b 100644
--- a/modules_k/pua/hash.c
+++ b/modules_k/pua/hash.c
@@ -255,7 +255,7 @@ void _insert_htable(ua_pres_t* presentity, unsigned int hash_code)
void insert_htable(ua_pres_t* presentity)
{
- int hash_code;
+ unsigned int hash_code;
hash_code= core_hash(presentity->pres_uri,presentity->watcher_uri, HASH_SIZE);
lock_get(&HashT->p_records[hash_code].lock);