<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Laura,<br>
    <br>
    thanks for the patch. I wonder how an xcap related function landed
    in utils module, perhaps Juha felt more comfortable adding it there.<br>
    <br>
    At first sight, patch looks ok. I cc-ed Juha in case he wants to
    have a look and integrate it. If not, I will commit before 3.2.2.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    On 1/30/12 1:01 PM, laura testi wrote:
    <blockquote
cite="mid:CAHFjjJNPEzfUsYfQes9ZqDE7NQ4u9CCSf1vngvihx9MEuA+r9A@mail.gmail.com"
      type="cite">
      <pre wrap="">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-&gt;name= %s\n", actions_node-&gt;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</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a></pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://linkedin.com/in/miconda">http://linkedin.com/in/miconda</a> -- <a class="moz-txt-link-freetext" href="http://twitter.com/miconda">http://twitter.com/miconda</a></pre>
  </body>
</html>