diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-11-03 17:01:43 +0400 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2018-11-09 07:50:02 -0600 |
commit | f898ee0f9951f2875c6cea299b4a1287e0a90e9f (patch) | |
tree | 4b829dae5b3d83cc65bd0e8c54655c9dbd3e6afd /qga/commands-win32.c | |
parent | 160e5c22e55b3f775c2003dfc626fa872ee4a7a1 (diff) | |
download | qemu-f898ee0f9951f2875c6cea299b4a1287e0a90e9f.zip qemu-f898ee0f9951f2875c6cea299b4a1287e0a90e9f.tar.gz qemu-f898ee0f9951f2875c6cea299b4a1287e0a90e9f.tar.bz2 |
qga-win: fix leaks of build_guest_disk_info()
Introduced in commit b1ba8890e63ce9432c41c5c3fc229f54c87c9c99, vol_h
handle should be closed, and "out" cleanup should be done after
DeviceIoControl() fails.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga/commands-win32.c')
-rw-r--r-- | qga/commands-win32.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c index ef1d7d4..62e1b51 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -797,7 +797,7 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) 0, extents, size, NULL, NULL)) { error_setg_win32(errp, GetLastError(), "failed to get disk extents"); - return NULL; + goto out; } } else if (last_err == ERROR_INVALID_FUNCTION) { /* Possibly CD-ROM or a shared drive. Try to pass the volume */ @@ -855,6 +855,9 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) out: + if (vol_h != INVALID_HANDLE_VALUE) { + CloseHandle(vol_h); + } qapi_free_GuestDiskAddress(disk); g_free(extents); g_free(name); |