Avoid setting GError multiple times in qmp_guest_file_open() by checking if errp is already set. This prevents crash caused by repeated error handling calls.
Signed-off-by: Wei Wang <[email protected]> --- qga/commands-win32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 0fd0c966e4..8c45ca5004 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -263,7 +263,9 @@ int64_t qmp_guest_file_open(const char *path, const char *mode, Error **errp) fd = guest_file_handle_add(fh, errp); if (fd < 0) { CloseHandle(fh); - error_setg(errp, "failed to add handle to qmp handle table"); + if (!*errp) { + error_setg(errp, "failed to add handle to qmp handle table"); + } goto done; } -- 2.39.5 (Apple Git-154)
