#22 Memory leak in SSDP AdvertiseAndReply

closed-accepted
None
9
2010-10-02
2008-12-05
Ulrik
No

Valgrind reports a memory leak function in AdvertiseAndReply (ssdp/ssdp_server.c) in libupnp 1.6.6

There are continue statements in many places in AdvertiseAndReply. In some of those error handling cases the variable nodelist is not free'ed before continuing to the next iteration. The next iteration will take care of free'ing the nodelist from the previous iteration in most cases, but not when breaking out of the for loop after the last element.

I belive this memory leak can be solved by makeing sure that the rows

ixmlNodeList_free( nodeList );
nodeList = NULL;

are always executed, also in the beginning of the last iteration when we found out that there are not more elements.

==29110== at 0x4C21C16: malloc (vg_replace_malloc.c:149)
==29110== by 0x5D8DE0E: ixmlNodeList_addToNodeList (nodeList.c:106)
==29110== by 0x5D8B7E2: ixmlNode_getElementsByTagNameRecursive (node.c:1438)
==29110== by 0x5D8E587: ixmlElement_getElementsByTagName (element.c:491)
==29110== by 0x5B6C0F1: AdvertiseAndReply (ssdp_server.c:201)
==29110== by 0x5B7AB74: UpnpSendAdvertisement (upnpapi.c:1495)

Discussion

  • Marcelo Roberto Jimenez

    • priority: 5 --> 9
    • assigned_to: nobody --> mroberto
    • status: open --> open-accepted
     
  • Marcelo Roberto Jimenez

    • status: open-accepted --> closed-accepted
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks