Skip to content

Commit aba41fc

Browse files
rozmansizx2c4
authored andcommitted
driver: fix memory leak on pre-Windows 7
Should NDIS version check fail the DriverEntry() bailed out without releasing the TunDispatchSecurityDescriptor. Signed-off-by: Simon Rozman <[email protected]>
1 parent c15bd01 commit aba41fc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

driver/wintun.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,15 +1457,14 @@ DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath)
14571457
{
14581458
NTSTATUS Status;
14591459

1460-
if (!NT_SUCCESS(Status = TunInitializeDispatchSecurityDescriptor()))
1461-
return Status;
1462-
14631460
NdisVersion = NdisGetVersion();
14641461
if (NdisVersion < NDIS_MINIPORT_VERSION_MIN)
14651462
return NDIS_STATUS_UNSUPPORTED_REVISION;
14661463
if (NdisVersion > NDIS_MINIPORT_VERSION_MAX)
14671464
NdisVersion = NDIS_MINIPORT_VERSION_MAX;
14681465

1466+
if (!NT_SUCCESS(Status = TunInitializeDispatchSecurityDescriptor()))
1467+
return Status;
14691468
ExInitializeResourceLite(&TunDispatchCtxGuard);
14701469
ExInitializeResourceLite(&TunDispatchDeviceListLock);
14711470

0 commit comments

Comments
 (0)