[PATCH v2] qga: fix a memory leak in qmp_guest_exec_status()
From:
Yi Wang
Subject:
[PATCH v2] qga: fix a memory leak in qmp_guest_exec_status()
Date:
Thu, 1 Jul 2021 01:44:41 +0800
From: Wang Yechao <wang.yechao255@zte.com.cn>
In some case, $GuestExecInfo.out.length maybe zero and the memory is leaked in qmp_guest_exec_status(). Call g_free() on the fileds directly to fix memory leak (NULL is ignored).
$GuestExecInfo.err.data has the same problem.
Signed-off-by: Yechao Wang <wang.yechao255@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
--- Changes in v2: - do not check the size > 0 when call g_free. Thanks to Marc. --- qga/commands.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)