diff --git a/drivers/storage/port/scsiport/registry.c b/drivers/storage/port/scsiport/registry.c index 3b9e235d752..24b197a81ef 100644 --- a/drivers/storage/port/scsiport/registry.c +++ b/drivers/storage/port/scsiport/registry.c @@ -212,13 +212,16 @@ RegistryInitAdapterKey( } /* Set 'Driver' (REG_SZ) value */ - PUNICODE_STRING driverNameU = &DeviceExtension->Common.DeviceObject->DriverObject->DriverName; + PUNICODE_STRING driverNameU = &DeviceExtension->Common.DeviceObject->DriverObject + ->DriverExtension->ServiceKeyName; + PWCHAR driverName = ExAllocatePoolWithTag(PagedPool, driverNameU->Length + sizeof(UNICODE_NULL), TAG_SCSIPORT); if (!driverName) { DPRINT("Failed to allocate driverName!\n"); + ZwClose(ScsiPortKey); return STATUS_INSUFFICIENT_RESOURCES; }