summary refs log tree commit diff stats
path: root/tests/functional/qemu_test
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2025-05-13 16:03:46 +0100
committerRichard Henderson <richard.henderson@linaro.org>2025-06-23 11:46:33 -0700
commit5171b794d4ac47efd81ef4da54137131e4ea550d (patch)
tree16a816d09cafc31db8ee7b94f1d30da84e38de89 /tests/functional/qemu_test
parenta9cd024c5822d08656127fde133975fde40f206c (diff)
downloadfocaccia-qemu-5171b794d4ac47efd81ef4da54137131e4ea550d.tar.gz
focaccia-qemu-5171b794d4ac47efd81ef4da54137131e4ea550d.zip
linux-user: fix resource leaks in gen-vdso
There are a number of resource leaks in gen-vdso. In theory they are
harmless because this is a short lived process, but when building QEMU
with --extra-cflags="-fsanitize=address" problems ensure. The gen-vdso
program is run as part of the build, and that aborts due to the
sanitizer identifying memory leaks, leaving QEMU unbuildable.

FAILED: libqemu-x86_64-linux-user.a.p/vdso.c.inc
/var/home/berrange/src/virt/qemu/build/linux-user/gen-vdso -o libqemu-x86_64-linux-user.a.p/vdso.c.inc ../linux-user/x86_64/vdso.so

=================================================================
==1696332==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2968 byte(s) in 1 object(s) allocated from:
    #0 0x56495873f1f3  (/var/home/berrange/src/virt/qemu/build/linux-user/gen-vdso+0xa11f3) (BuildId: b69e241ad44719b6f3934f3c71dfc6727e8bdb12)
    #1 0x564958780b90  (/var/home/berrange/src/virt/qemu/build/linux-user/gen-vdso+0xe2b90) (BuildId: b69e241ad44719b6f3934f3c71dfc6727e8bdb12)

This complaint is about the 'buf' variable, however, the FILE objects
are also leaked in some error scenarios, so this fix refactors the
cleanup paths to fix all leaks. For completeness it also reports an
error if fclose() fails on 'inf'.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Arusekk <floss@arusekk.pl>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250513150346.1328217-1-berrange@redhat.com>
Diffstat (limited to 'tests/functional/qemu_test')
0 files changed, 0 insertions, 0 deletions