[PATCH] qga: fix a memory leak in qmp_guest_exec_status()
From:
Yi Wang
Subject:
[PATCH] qga: fix a memory leak in qmp_guest_exec_status()
Date:
Wed, 30 Jun 2021 23:33:19 +0800
From: Wang Yechao <wang.yechao255@zte.com.cn>
The $GuestExecInfo.out.data is alloced in guest_exec_output_watch(), and the buffer size is $GuestExecInfo.out.size. We should free the $GuestExecInfo.out.data judge by the size, not length. Because the $GuestExecInfo.out.length maybe zero in some case.
$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>
--- qga/commands.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)