sds icon indicating copy to clipboard operation
sds copied to clipboard

valgrind reports realloc-related memory leaks

Open roblatham00 opened this issue 11 years ago • 0 comments

There is something about sdsMakeRoomFor that leaks memory, at least according to valgrind:

==31090== HEAP SUMMARY:
==31090==     in use at exit: 40 bytes in 2 blocks
==31090==   total heap usage: 33 allocs, 31 frees, 526 bytes allocated
==31090== 
==31090== 13 bytes in 1 blocks are definitely lost in loss record 1 of 2
==31090==    at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==31090==    by 0x401B51: sdsMakeRoomFor (sds.c:160)
==31090==    by 0x40132A: main (sds.c:926)
==31090== 
==31090== 27 bytes in 1 blocks are definitely lost in loss record 2 of 2
==31090==    at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==31090==    by 0x401B51: sdsMakeRoomFor (sds.c:160)
==31090==    by 0x401CF0: sdscatlen (sds.c:269)
==31090==    by 0x401EFA: sdscatvprintf (sds.c:342)
==31090==    by 0x401FA6: sdscatprintf (sds.c:367)
==31090==    by 0x4026AE: sdscatrepr (sds.c:602)
==31090==    by 0x40126A: main (sds.c:915)
==31090== 
==31090== LEAK SUMMARY:
==31090==    definitely lost: 40 bytes in 2 blocks
==31090==    indirectly lost: 0 bytes in 0 blocks
==31090==      possibly lost: 0 bytes in 0 blocks
==31090==    still reachable: 0 bytes in 0 blocks
==31090==         suppressed: 0 bytes in 0 blocks

roblatham00 avatar Nov 24 '14 22:11 roblatham00