{
if (FileObject->FileName.Buffer)
{
- ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
+ /*
+ * Don't use TAG_IO_NAME since the FileObject's FileName
+ * may have been re-allocated using a different tag
+ * by a filesystem.
+ */
+ ExFreePoolWithTag(FileObject->FileName.Buffer, 0);
}
FileObject->FileName.Buffer = NewBuffer;
/* The driver failed to create the file */
if (!NT_SUCCESS(Status))
{
- /* Check if we have a name */
+ /* Check if we have a name and if so, free it */
if (FileObject->FileName.Length)
{
- /* Free it */
- ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
+ /*
+ * Don't use TAG_IO_NAME since the FileObject's FileName
+ * may have been re-allocated using a different tag
+ * by a filesystem.
+ */
+ ExFreePoolWithTag(FileObject->FileName.Buffer, 0);
+ FileObject->FileName.Buffer = NULL;
FileObject->FileName.Length = 0;
}
/* Release the old one */
if (CompleteName->Buffer != NULL)
{
+ /*
+ * Don't use TAG_IO_NAME since the FileObject's FileName
+ * may have been re-allocated using a different tag
+ * by a filesystem.
+ */
ExFreePoolWithTag(CompleteName->Buffer, 0);
}
}
}
- /* Check if we have a name */
+ /* Check if we have a name and if so, free it */
if (FileObject->FileName.Length)
{
- /* Free it */
+ /*
+ * Don't use TAG_IO_NAME since the FileObject's FileName
+ * may have been re-allocated using a different tag
+ * by a filesystem.
+ */
ExFreePoolWithTag(FileObject->FileName.Buffer, 0);
+ FileObject->FileName.Buffer = NULL;
FileObject->FileName.Length = 0;
}
/* Clear the file name */
if (FileObject->FileName.Buffer)
{
- ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
- FileObject->FileName.Buffer = NULL;
+ /*
+ * Don't use TAG_IO_NAME since the FileObject's FileName
+ * may have been re-allocated using a different tag
+ * by a filesystem.
+ */
+ ExFreePoolWithTag(FileObject->FileName.Buffer, 0);
+ FileObject->FileName.Buffer = NULL;
}
/* Check if the FO had a completion port */