ImagingDataCommons / libdicom

C library for reading DICOM files
https://libdicom.readthedocs.io
MIT License
16 stars 7 forks source link

memory leak #8

Closed jcupitt closed 2 years ago

jcupitt commented 2 years ago

Hi, valgrind is reporting a memleak in the dev branch for this test file:

http://www.rollthepotato.net/~john/MRIm5.dcm

I see:

$ valgrind --leak-check=yes --suppressions=/home/john/GIT/libdicom/supp/set_default_local.supp dcm-dump MRIm5.dcm
...
==3748788==     in use at exit: 32 bytes in 2 blocks
==3748788==   total heap usage: 561 allocs, 559 frees, 26,168 bytes allocated
==3748788== 
==3748788== 32 bytes in 2 blocks are definitely lost in loss record 1 of 1
==3748788==    at 0x4843839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==3748788==    by 0x4874D3F: iheader_create (dicom-file.c:64)
==3748788==    by 0x487585D: read_item_header (dicom-file.c:255)
==3748788==    by 0x48768B9: read_element (dicom-file.c:519)
==3748788==    by 0x487829D: dcm_file_read_metadata (dicom-file.c:1053)
==3748788==    by 0x1094B4: main (dcm-dump.c:60)
==3748788== 
==3748788== LEAK SUMMARY:
==3748788==    definitely lost: 32 bytes in 2 blocks
==3748788==    indirectly lost: 0 bytes in 0 blocks
==3748788==      possibly lost: 0 bytes in 0 blocks
==3748788==    still reachable: 0 bytes in 0 blocks
==3748788==         suppressed: 0 bytes in 0 blocks