Memory leak when opening files in read only
When sanitizing memory access for Linktest we noticed that reading from a SION file with SIONlib 1.7.7 causes a memory leak.
Direct leak of 1024 byte(s) in 1 object(s) allocated from:
#0 0x563dbe582378 in __interceptor_malloc (/home/holicki/linktest/SIONtest.exe+0xf5378)
#1 0x563dbe5e0b33 in _sion_get_multi_filename /home/holicki/linktest/SIONlib/build-linux-gomp-openmpi/build/lib/sion_internal.c:915
#2 0x563dbe5c7314 in sion_generic_paropen /home/holicki/linktest/SIONlib/build-linux-gomp-openmpi/build/parlib/sion_generic.c:529
#3 0x563dbe5c40a7 in sion_paropen_mpi /home/holicki/linktest/SIONlib/build-linux-gomp-openmpi/build/parlib/sion_mpi_gen.c:205
It has to do with the last parameter of sion_generic_paropen()
, which is a char
pointer. The memory that this pointer points to is not deleted. If this is the users responsibility then this should be stated explicitly in the documentation. Otherwise SIONlib should clean this up when closing the file.
Note this problem does not always occur when writing.
This is still present in the newer SIONlib versions.