• Marc-André Lureau's avatar
    slirp: fix leak · 7d824696
    Marc-André Lureau authored
    Spotted by ASAN:
    
    /x86_64/hmp/pc-0.12:
    =================================================================
    ==22538==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 224 byte(s) in 1 object(s) allocated from:
        #0 0x7f0f63cdee60 in malloc (/lib64/libasan.so.3+0xc6e60)
        #1 0x556f11ff32d7 in tcp_newtcpcb /home/elmarco/src/qemu/slirp/tcp_subr.c:250
        #2 0x556f11fdb1d1 in tcp_listen /home/elmarco/src/qemu/slirp/socket.c:688
        #3 0x556f11fca9d5 in slirp_add_hostfwd /home/elmarco/src/qemu/slirp/slirp.c:1052
        #4 0x556f11f8db41 in slirp_hostfwd /home/elmarco/src/qemu/net/slirp.c:506
        #5 0x556f11f8dd83 in hmp_hostfwd_add /home/elmarco/src/qemu/net/slirp.c:535
    
    There might be a better way to fix this, but calling slirp tcp_close()
    doesn't work.
    Signed-off-by: 's avatarMarc-André Lureau <marcandre.lureau@redhat.com>
    Signed-off-by: 's avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
    7d824696
socket.c 22.5 KB