aboutsummaryrefslogtreecommitdiffstats
path: root/driver/wintun.c
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2021-07-13 10:20:21 +0200
committerSimon Rozman <simon@rozman.si>2021-07-13 14:33:43 +0200
commit928f21c5736160651d479b4be37dadc682d89284 (patch)
tree8b78d530c7d0a61bdd862526fb1912a25cf25a5f /driver/wintun.c
parentdriver: cleanup project file (diff)
downloadwintun-928f21c5736160651d479b4be37dadc682d89284.tar.xz
wintun-928f21c5736160651d479b4be37dadc682d89284.zip
driver: switch to MS-recommended memory alloc
Suggested-by: Static Driver Verifier Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to '')
-rw-r--r--driver/wintun.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/driver/wintun.c b/driver/wintun.c
index 0b4bfe1..ae42552 100644
--- a/driver/wintun.c
+++ b/driver/wintun.c
@@ -988,10 +988,10 @@ TunInitializeEx(
/* Leaking memory 'Ctx'. Note: 'Ctx' is freed in TunHaltEx or on failure. */
#pragma warning(suppress : 6014)
- TUN_CTX *Ctx = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(*Ctx), TUN_MEMORY_TAG);
+#pragma warning(suppress : 28160)
+ TUN_CTX *Ctx = ExAllocatePoolZero(NonPagedPool, sizeof(*Ctx), TUN_MEMORY_TAG);
if (!Ctx)
return NDIS_STATUS_FAILURE;
- NdisZeroMemory(Ctx, sizeof(*Ctx));
Ctx->MiniportAdapterHandle = MiniportAdapterHandle;
@@ -1420,6 +1420,8 @@ DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath)
{
NTSTATUS Status;
+ ExInitializeDriverRuntime(DrvRtPoolNxOptIn);
+
NdisVersion = NdisGetVersion();
if (NdisVersion < NDIS_MINIPORT_VERSION_MIN)
return NDIS_STATUS_UNSUPPORTED_REVISION;