From 9bd8e9330ade42878b19a5172131087220d590d5 Mon Sep 17 00:00:00 2001
From: Li Ping
Date: Fri, 23 Jun 2017 11:17:43 +0800
Subject: qga-win32: Fix memory leak of device information set
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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
Reviewed-by: Marc-André Lureau
Signed-off-by: Michael Tokarev
---
qga/commands-win32.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'qga')
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);
--
cgit v1.2.3