aboutsummaryrefslogtreecommitdiffstats
path: root/api/driver.c
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2020-10-24 22:12:47 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-10-30 16:51:01 +0100
commitbf4eabb4ca3fb1d0c68b375a2a964165776e44cb (patch)
tree4fe9d219bf6c64a7447caa17eb4f33405f4d7647 /api/driver.c
parentapi: add ring management (diff)
downloadwintun-bf4eabb4ca3fb1d0c68b375a2a964165776e44cb.tar.xz
wintun-bf4eabb4ca3fb1d0c68b375a2a964165776e44cb.zip
api: switch to private heap
We must not use the process heap, as it is changeable. Client may change it causing our HeapFree() to use wrong heap. Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/driver.c')
-rw-r--r--api/driver.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/api/driver.c b/api/driver.c
index 0bb2750..3308794 100644
--- a/api/driver.c
+++ b/api/driver.c
@@ -38,7 +38,6 @@ DriverRemoveAllOurs(void)
Result = LOG_LAST_ERROR(L"Failed to build list of drivers");
goto cleanupDeviceInfoSet;
}
- HANDLE Heap = GetProcessHeap();
for (DWORD EnumIndex = 0;; ++EnumIndex)
{
SP_DRVINFO_DATA_W DrvInfoData = { .cbSize = sizeof(DrvInfoData) };
@@ -56,7 +55,7 @@ DriverRemoveAllOurs(void)
}
if (!DriverIsOurDrvInfoDetail(DrvInfoDetailData))
{
- HeapFree(Heap, 0, DrvInfoDetailData);
+ HeapFree(ModuleHeap, 0, DrvInfoDetailData);
continue;
}
PathStripPathW(DrvInfoDetailData->InfFileName);
@@ -66,7 +65,7 @@ DriverRemoveAllOurs(void)
LOG_LAST_ERROR(L"Unable to remove existing driver");
Result = Result != ERROR_SUCCESS ? Result : GetLastError();
}
- HeapFree(Heap, 0, DrvInfoDetailData);
+ HeapFree(ModuleHeap, 0, DrvInfoDetailData);
}
SetupDiDestroyDriverInfoList(DevInfo, NULL, SPDIT_CLASSDRIVER);
cleanupDeviceInfoSet: