Skip to content
Snippets Groups Projects
Commit 02ac3f4b authored by Basil Salman's avatar Basil Salman Committed by Michael Roth
Browse files

qga-win: Fix build_guest_fsinfo() close of nonexistent


On the current error path of build_guest_fsinfo(), a non existent handle
is passed to CloseHandle().

This patch adds initialization of hLocalDiskHandle to
INVALID_HANDLE_VALUE, and checks for handle validity before the handle
is closed.

Signed-off-by: default avatarBasil Salman <basil@daynix.com>
Signed-off-by: default avatarBasil Salman <basil@redhat.com>
Signed-off-by: default avatarMichael Roth <michael.roth@amd.com>
parent 3d98f9b6
No related branches found
No related tags found
No related merge requests found
......@@ -1091,7 +1091,7 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
size_t len;
uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes;
GuestFilesystemInfo *fs = NULL;
HANDLE hLocalDiskHandle = NULL;
HANDLE hLocalDiskHandle = INVALID_HANDLE_VALUE;
GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size);
if (GetLastError() != ERROR_MORE_DATA) {
......@@ -1149,7 +1149,9 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
fs->type = g_strdup(fs_name);
fs->disk = build_guest_disk_info(guid, errp);
free:
CloseHandle(hLocalDiskHandle);
if (hLocalDiskHandle != INVALID_HANDLE_VALUE) {
CloseHandle(hLocalDiskHandle);
}
g_free(mnt_point);
return fs;
}
......
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