qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/4] gqa-win: get_pci_info: Clean dev_info if handle is valid
@ 2021-08-09  9:48 Kostiantyn Kostiuk
  2021-08-09  9:48 ` [RFC 2/4] gqa-win: get_pci_info: Use common 'cleanup' label Kostiantyn Kostiuk
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kostiantyn Kostiuk @ 2021-08-09  9:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Roth, Matt Hines, Michael Roth

Signed-off-by: Kostiantyn Kostiuk <konstantin@daynix.com>
---
 qga/commands-win32.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 27baf17d6c..2ad8593b82 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -514,7 +514,7 @@ DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT,
 
 static GuestPCIAddress *get_pci_info(int number, Error **errp)
 {
-    HDEVINFO dev_info;
+    HDEVINFO dev_info = INVALID_HANDLE_VALUE;
     SP_DEVINFO_DATA dev_info_data;
     SP_DEVICE_INTERFACE_DATA dev_iface_data;
     HANDLE dev_file;
@@ -749,7 +749,9 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp)
     }
 
 free_dev_info:
-    SetupDiDestroyDeviceInfoList(dev_info);
+    if (dev_info != INVALID_HANDLE_VALUE) {
+        SetupDiDestroyDeviceInfoList(dev_info);
+    }
 out:
     return pci;
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-10 10:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-09  9:48 [RFC 1/4] gqa-win: get_pci_info: Clean dev_info if handle is valid Kostiantyn Kostiuk
2021-08-09  9:48 ` [RFC 2/4] gqa-win: get_pci_info: Use common 'cleanup' label Kostiantyn Kostiuk
2021-08-09  9:48 ` [RFC 3/4] gqa-win: get_pci_info: Add g_autofree for few variables Kostiantyn Kostiuk
2021-08-09 10:46   ` Philippe Mathieu-Daudé
2021-08-10 10:49     ` Konstantin Kostiuk
2021-08-09  9:48 ` [RFC 4/4] gqa-win: get_pci_info: Free parent_dev_info properly Kostiantyn Kostiuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).