Skip to content
Snippets Groups Projects
Commit f898ee0f authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Michael Roth
Browse files

qga-win: fix leaks of build_guest_disk_info()


Introduced in commit b1ba8890, vol_h
handle should be closed, and "out" cleanup should be done after
DeviceIoControl() fails.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
parent 160e5c22
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment