|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 08/10] xencontrol: fix SetupDiDestroyDeviceInfoList never called in XcOpen
SetupDiGetClassDevs returns a device info set handle that must be
freed with SetupDiDestroyDeviceInfoList. On all failure paths between
SetupDiGetClassDevs and the end label the handle was leaked. Init
DevInfo to INVALID_HANDLE_VALUE and call SetupDiDestroyDeviceInfoList
at the end label when the handle is valid.
Signed-off-by: david ambu <david.preetham@xxxxxxxxxx>
Assisted by Claude Sonnet 4.6
---
src/xencontrol/xencontrol.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/xencontrol/xencontrol.c b/src/xencontrol/xencontrol.c
index 1fdfd0b..a68dcf6 100644
--- a/src/xencontrol/xencontrol.c
+++ b/src/xencontrol/xencontrol.c
@@ -89,7 +89,7 @@ XcOpen(
_Outptr_result_maybenull_ PXENCONTROL_CONTEXT *Xc
)
{
- HDEVINFO DevInfo;
+ HDEVINFO DevInfo =
INVALID_HANDLE_VALUE;
SP_DEVICE_INTERFACE_DATA InterfaceData;
SP_DEVICE_INTERFACE_DETAIL_DATA *DetailData = NULL;
DWORD BufferSize;
@@ -168,6 +168,9 @@ XcOpen(
end:
free(DetailData);
+ if (DevInfo != INVALID_HANDLE_VALUE)
+ SetupDiDestroyDeviceInfoList(DevInfo);
+
if (Status != ERROR_SUCCESS) {
free(Context);
*Xc = NULL;
--
2.51.0.windows.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |