Menu

#1169 Memory leak in internalProvider.c

Memory_Leak
pending-fixed
sfcb (1090)
5
2012-07-03
2008-02-25
No

The bug is that when iterating over the assocs hashtable, the key value returned by getFirst() and getNext() is actually a char *, and not a UtilStringBuffer *. This means that the cast will fail and SFCB will probably crash. Also, the buffers returned here need to be explicitly freed as they were allocated using malloc().

By storing the result of an->ft->GetCharPtr() in the hashtable we are losing the pointer back to the UtilStringBuffer so there's no way to call release() on it.

(issue reported by Tim Potter)

Discussion

  • Chris Buccella

    Chris Buccella - 2008-05-01
    • assigned_to: buccella --> smswehla
     
  • Chris Buccella

    Chris Buccella - 2012-06-27

    Leak #1 detail:

    ==26982== 60 (12 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 13 of 46
    ==26982== at 0x4024A29: malloc (vg_replace_malloc.c:207)
    ==26982== by 0x406E990: memAddEncObj (support.c:569)
    ==26982== by 0x406EB83: memAddUtilList (support.c:602)
    ==26982== by 0x438115C: newList (genericlist.c:723)
    ==26982== by 0x40B35DE: getRefs (internalProvider.c:627)
    ==26982== by 0x40B437A: InternalProviderAssociators (internalProvider.c:834)
    ==26982== by 0x408F9DD: associators (providerDrv.c:2501)
    ==26982== by 0x40943FD: processProviderInvocationRequestsThread (providerDrv.c:3425)
    ==26982== by 0x438E82F: start_thread (in /lib/libpthread-2.11.1.so)
    ==26982== by 0x44821BD: clone (in /lib/libc-2.11.1.so)

     
  • Chris Buccella

    Chris Buccella - 2012-06-27

    Leak #2 detail:

    ==26982== 2,112 (64 direct, 2,048 indirect) bytes in 4 blocks are definitely lost in loss record 41 of 46
    ==26982== at 0x4024A29: malloc (vg_replace_malloc.c:207)
    ==26982== by 0x438229E: newStringBuffer (utilStringBuffer.c:179)
    ==26982== by 0x406983A: normalizeObjectPathStrBuf (objectpath.c:737)
    ==26982== by 0x40B3524: objectPathEquals (internalProvider.c:608)
    ==26982== by 0x40B3F9C: getRefs (internalProvider.c:768)
    ==26982== by 0x40B437A: InternalProviderAssociators (internalProvider.c:834)
    ==26982== by 0x408F9DD: associators (providerDrv.c:2501)
    ==26982== by 0x40943FD: processProviderInvocationRequestsThread (providerDrv.c:3425)
    ==26982== by 0x438E82F: start_thread (in /lib/libpthread-2.11.1.so)
    ==26982== by 0x44821BD: clone (in /lib/libc-2.11.1.so)

     
  • Chris Buccella

    Chris Buccella - 2012-06-27

    Leak #3:

    ==20871== 253 bytes in 10 blocks are definitely lost in loss record 21 of 52
    ==20871== at 0x4024A29: malloc (vg_replace_malloc.c:207)
    ==20871== by 0x441BA3F: strdup (in /lib/libc-2.11.1.so)
    ==20871== by 0x4083ACF: _getConstClassChildren (providerMgr.c:1837)
    ==20871== by 0x407EC11: addAssocProviders (providerMgr.c:613)
    ==20871== by 0x407EC61: addAssocProviders (providerMgr.c:620)
    ==20871== by 0x407EEBB: getAssocProviders (providerMgr.c:653)
    ==20871== by 0x407F07C: assocProviderList (providerMgr.c:679)
    ==20871== by 0x4080738: processProviderMgrRequests (providerMgr.c:1051)
    ==20871== by 0x804B1E0: main (sfcBroker.c:922)

     
  • Chris Buccella

    Chris Buccella - 2012-07-03
    • assigned_to: smswehla --> buccella
    • status: open --> pending
     
  • Chris Buccella

    Chris Buccella - 2012-07-03

    committed to CVS HEAD and git master

     
  • Chris Buccella

    Chris Buccella - 2012-07-03
    • status: pending --> open-fixed
     
  • Chris Buccella

    Chris Buccella - 2012-07-03
    • status: open-fixed --> pending-fixed
     
  • Chris Buccella

    Chris Buccella - 2012-07-06

    committed patch (1.3 branch)

     

Log in to post a comment.