mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-10 13:13:34 +01:00
WIndows driver: add check for failed memory allocation
This commit is contained in:
parent
17af27bc7f
commit
6cdcbac305
@ -3734,16 +3734,19 @@ NTSTATUS MountDevice (PDEVICE_OBJECT DeviceObject, MOUNT_STRUCT *mount)
|
||||
IO_STATUS_BLOCK ioblock;
|
||||
ULONG labelInfoSize = sizeof(FILE_FS_LABEL_INFORMATION) + (labelEffectiveLen * sizeof(WCHAR));
|
||||
FILE_FS_LABEL_INFORMATION* labelInfo = (FILE_FS_LABEL_INFORMATION*) TCalloc (labelInfoSize);
|
||||
labelInfo->VolumeLabelLength = labelEffectiveLen * sizeof(WCHAR);
|
||||
memcpy (labelInfo->VolumeLabel, mount->wszLabel, labelInfo->VolumeLabelLength);
|
||||
|
||||
if (STATUS_SUCCESS == ZwSetVolumeInformationFile (volumeHandle, &ioblock, labelInfo, labelInfoSize, FileFsLabelInformation))
|
||||
if (labelInfo)
|
||||
{
|
||||
mount->bDriverSetLabel = TRUE;
|
||||
NewExtension->bDriverSetLabel = TRUE;
|
||||
}
|
||||
labelInfo->VolumeLabelLength = labelEffectiveLen * sizeof(WCHAR);
|
||||
memcpy (labelInfo->VolumeLabel, mount->wszLabel, labelInfo->VolumeLabelLength);
|
||||
|
||||
TCfree(labelInfo);
|
||||
if (STATUS_SUCCESS == ZwSetVolumeInformationFile (volumeHandle, &ioblock, labelInfo, labelInfoSize, FileFsLabelInformation))
|
||||
{
|
||||
mount->bDriverSetLabel = TRUE;
|
||||
NewExtension->bDriverSetLabel = TRUE;
|
||||
}
|
||||
|
||||
TCfree(labelInfo);
|
||||
}
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user