diff options
author | Li Ping | 2017-06-23 05:17:43 +0200 |
---|---|---|
committer | Michael Tokarev | 2017-07-11 10:18:37 +0200 |
commit | 9bd8e9330ade42878b19a5172131087220d590d5 (patch) | |
tree | f7874e67c4d47f86edefedfbd6e3bbcaa7d10a9d /qga/commands-win32.c | |
parent | hw/core: fix missing return value in load_image_targphys_as() (diff) | |
download | qemu-9bd8e9330ade42878b19a5172131087220d590d5.tar.gz qemu-9bd8e9330ade42878b19a5172131087220d590d5.tar.xz qemu-9bd8e9330ade42878b19a5172131087220d590d5.zip |
qga-win32: Fix memory leak of device information set
The caller of SetupDiGetClassDevs must delete the returned device information
set when it is no longer needed by calling SetupDiDestroyDeviceInfoList.
Signed-off-by: Li Ping <li.ping288@zte.com.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
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 439d229225..6f1645747b 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -512,7 +512,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp) } else { error_setg_win32(errp, GetLastError(), "failed to get device name"); - goto out; + goto free_dev_info; } } @@ -560,6 +560,9 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp) pci->bus = bus; break; } + +free_dev_info: + SetupDiDestroyDeviceInfoList(dev_info); out: g_free(buffer); g_free(name); |