]> Git Repo - qemu.git/commitdiff
qga-win32: Fix memory leak of device information set
authorLi Ping <[email protected]>
Fri, 23 Jun 2017 03:17:43 +0000 (11:17 +0800)
committerMichael Tokarev <[email protected]>
Tue, 11 Jul 2017 08:18:37 +0000 (11:18 +0300)
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 <[email protected]>
Reviewed-by: Marc-AndrĂ© Lureau <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
qga/commands-win32.c

index 439d2292259309d496e2db7bf66f3779a42f3f69..6f1645747b1a8e553f8deb52617b7a1f35c9046d 100644 (file)
@@ -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);
This page took 0.02745 seconds and 4 git commands to generate.