Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2021-08-03…
Browse files Browse the repository at this point in the history
…-pull-tag' into staging

qemu-ga patch queue for hard-freeze

* w32: Fix missing/incorrect DLLs in MSI installer
* w32: Fix memory leaks in guest-get-osinfo/guest-get-fsinfo
* w32: Increase timeout for guest-fsfreeze-freeze

# gpg: Signature made Tue 03 Aug 2021 13:09:15 BST
# gpg:                using RSA key CEACC9E15534EBABB82D3FA03353C9CEF108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>" [full]
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>" [full]
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>" [full]
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584

* remotes/mdroth/tags/qga-pull-2021-08-03-pull-tag:
  qga-win/msi: fix missing libstdc++-6 DLL in MSI installer
  qemu-ga/msi: fix w32 libgcc name
  qga-win: Free GMatchInfo properly
  qga-win: Fix handle leak in ga_get_win_product_name()
  qga-win: Fix build_guest_fsinfo() close of nonexistent
  qga-win: Increase VSS freeze timeout to 60 secs instead of 10

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Aug 3, 2021
2 parents 7f1cab9 + e300858 commit acf8200
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
18 changes: 12 additions & 6 deletions qga/commands-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -2229,7 +2231,7 @@ static char *ga_get_win_name(OSVERSIONINFOEXW const *os_version, bool id)

static char *ga_get_win_product_name(Error **errp)
{
HKEY key = NULL;
HKEY key = INVALID_HANDLE_VALUE;
DWORD size = 128;
char *result = g_malloc0(size);
LONG err = ERROR_SUCCESS;
Expand All @@ -2239,7 +2241,8 @@ static char *ga_get_win_product_name(Error **errp)
&key);
if (err != ERROR_SUCCESS) {
error_setg_win32(errp, err, "failed to open registry key");
goto fail;
g_free(result);
return NULL;
}

err = RegQueryValueExA(key, "ProductName", NULL, NULL,
Expand All @@ -2260,9 +2263,13 @@ static char *ga_get_win_product_name(Error **errp)
goto fail;
}

RegCloseKey(key);
return result;

fail:
if (key != INVALID_HANDLE_VALUE) {
RegCloseKey(key);
}
g_free(result);
return NULL;
}
Expand Down Expand Up @@ -2452,7 +2459,7 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)
continue;
}
for (j = 0; hw_ids[j] != NULL; j++) {
GMatchInfo *match_info;
g_autoptr(GMatchInfo) match_info;
GuestDeviceIdPCI *id;
if (!g_regex_match(device_pci_re, hw_ids[j], 0, &match_info)) {
continue;
Expand All @@ -2469,7 +2476,6 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)
id->vendor_id = g_ascii_strtoull(vendor_id, NULL, 16);
id->device_id = g_ascii_strtoull(device_id, NULL, 16);

g_match_info_free(match_info);
break;
}
if (skip) {
Expand Down
6 changes: 5 additions & 1 deletion qga/installer/qemu-ga.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<?endif?>

<?if $(var.Arch) = "32"?>
<?define ArchLib=libgcc_s_sjlj-1.dll?>
<?define ArchLib=libgcc_s_dw2-1.dll?>
<?define GaProgramFilesFolder="ProgramFilesFolder" ?>
<?endif?>

Expand Down Expand Up @@ -84,6 +84,9 @@
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="QEMU-GA" Wait="yes" />
</Component>
<?ifdef var.InstallVss?>
<Component Id="libstdc++_6_lib" Guid="{55E737B5-9127-4A11-9FC3-A29367714574}">
<File Id="libstdc++-6.lib" Name="libstdc++-6.dll" Source="$(var.Mingw_bin)/libstdc++-6.dll" KeyPath="yes" DiskId="1"/>
</Component>
<Component Id="qga_vss_dll" Guid="{CB19C453-FABB-4BB1-ABAB-6B74F687BFBB}">
<File Id="qga_vss.dll" Name="qga-vss.dll" Source="$(env.BUILD_DIR)/qga/vss-win32/qga-vss.dll" KeyPath="yes" DiskId="1"/>
</Component>
Expand Down Expand Up @@ -164,6 +167,7 @@
<Feature Id="QEMUFeature" Title="QEMU Guest Agent" Level="1">
<ComponentRef Id="qemu_ga" />
<?ifdef var.InstallVss?>
<ComponentRef Id="libstdc++_6_lib" />
<ComponentRef Id="qga_vss_dll" />
<ComponentRef Id="qga_vss_tlb" />
<?endif?>
Expand Down
2 changes: 1 addition & 1 deletion qga/vss-win32/requester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <inc/win2003/vsbackup.h>

/* Max wait time for frozen event (VSS can only hold writes for 10 seconds) */
#define VSS_TIMEOUT_FREEZE_MSEC 10000
#define VSS_TIMEOUT_FREEZE_MSEC 60000

/* Call QueryStatus every 10 ms while waiting for frozen event */
#define VSS_TIMEOUT_EVENT_MSEC 10
Expand Down

0 comments on commit acf8200

Please sign in to comment.