DriverLoader: Fix freeing loaded file

This commit is contained in:
Nodir Temirkhodjaev 2021-12-19 13:11:04 +03:00
parent c8347d90f6
commit 4df123f3aa

View File

@ -94,14 +94,14 @@ static NTSTATUS fort_loader_init(PUNICODE_STRING driverPath)
DWORD payloadSize = 0;
status = fort_image_payload(data, dataSize, &payload, &payloadSize);
/* Free the driver file's allocated data */
fort_mem_free(data, FORT_LOADER_POOL_TAG);
/* Load the module driver */
if (NT_SUCCESS(status)) {
status = LoadModuleFromMemory(&g_loader.module, payload, payloadSize);
}
/* Free the driver file's allocated data */
fort_mem_free(data, FORT_LOADER_POOL_TAG);
if (!NT_SUCCESS(status)) {
DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,
"FORT: Loader Image Payload: Error: %x\n", status);