• Kirill Smelkov's avatar
    bigfile: Plug memory leak in ramh_close() · 997ebacd
    Kirill Smelkov authored
    No one was freeing RAMH structure itself, and thus ASAN reports e.g.:
    
    ==15935==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x7f29c89f1001 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x94001)
        #1 0x401da1 in zalloc include/wendelin/utils.h:65
        #2 0x408128 in shmfs_ramh_open bigfile/tests/../ram_shmfs.c:202
        #3 0x407611 in ramh_open bigfile/tests/../ram.c:81
        #4 0x402560 in fileh_open bigfile/tests/../virtmem.c:131
        #5 0x427ca1 in test_pagefault_savestate bigfile/tests/test_virtmem.c:1022
        #6 0x4281ba in main bigfile/tests/test_virtmem.c:1061
        #7 0x7f29c83b8b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
    
    NOTE similar leak remains open in ram_close(), but it is a bit involved
    to fix and the effort will be removed anyway after we switch to kernel
    virtual memory manager. Besides ramh are opened and closed all the time
    and ram only once.
    997ebacd
ram_shmfs.c 7.21 KB