Re: [PATCH v2] system/vl: Free allocate memory for pid file name in case realpath() failed

Philippe Mathieu-Daudé <[email protected]> Mon, 18 May 2026 14:31:17 +0200
Newsgroups org.nongnu.qemu-trivial,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 18/5/26 13:45, Thomas Huth wrote:
> From: Thomas Huth <[email protected]>
> 
> In case realpath() fails, the code returns early in the function
> qemu_maybe_daemonize(), without freeing the allocated memory. Add
> a g_free() here to fix it.
> And while we're at it, also free the memory in the qemu_unlink_pidfile()
> function - it's not that important since QEMU is going to terminate anyway,
> but some malloc sanitizers might still complain if we don't free it.
> 
> Fixes: dee2a4d4d2f ("vl: defuse PID file path resolve error")
> Signed-off-by: Thomas Huth <[email protected]>
> ---
>   v2: Free memory in qemu_unlink_pidfile(), too
> 
>   system/vl.c | 3 +++
>   1 file changed, 3 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>