qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] coverity-spotted memory leak in hw/riscv/spike.c


From: Peter Maydell
Subject: [Qemu-devel] coverity-spotted memory leak in hw/riscv/spike.c
Date: Mon, 5 Nov 2018 13:35:36 +0000

Hi; Coverity has noticed a memory leak in hw/riscv/spike.c:
it malloc()s memory into config_string(), but never frees it.
(CID 1391015). This isn't a very serious leak since the function
only ever runs once, but it would be nice to fix this for 3.1
(it is the only coverity error in the riscv code, and one of
just 8 unaddressed for QEMU as a whole).

Incidentally, "malloc and then snprintf" would be better
done using g_strdup_printf(), which automatically allocates
sufficient memory for the string, avoiding the need to
try to pre-calculate the right size.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]