[BOOT:MM] Fix descriptor memory leaks

Sometimes when handling MmMdAddDescriptorToList() errors, descriptors
were not freed with MmMdFreeDescriptor().
This commit is contained in:
2024-09-01 16:56:18 -04:00
parent 65e33fdad5
commit 43c6c75710
3 changed files with 15 additions and 2 deletions

View File

@@ -421,6 +421,7 @@ Return Value:
Status = MmMdAddDescriptorToList(Mdl, NtDescriptor, MDL_OPERATION_FLAGS_TRUNCATE);
if (!NT_SUCCESS(Status)) {
MmMdFreeDescriptor(NtDescriptor);
goto exit;
}
@@ -456,6 +457,7 @@ Return Value:
Status = MmMdAddDescriptorToList(Mdl, NtDescriptor, MDL_OPERATION_FLAGS_TRUNCATE);
if (!NT_SUCCESS(Status)) {
MmMdFreeDescriptor(NtDescriptor);
goto exit;
}
@@ -486,6 +488,7 @@ Return Value:
Status = MmMdAddDescriptorToList(Mdl, NtDescriptor, MDL_OPERATION_FLAGS_TRUNCATE);
if (!NT_SUCCESS(Status)) {
MmMdFreeDescriptor(NtDescriptor);
goto exit;
}
}
@@ -507,6 +510,7 @@ Return Value:
Status = MmMdAddDescriptorToList(Mdl, NtDescriptor, MDL_OPERATION_FLAGS_TRUNCATE);
if (!NT_SUCCESS(Status)) {
MmMdFreeDescriptor(NtDescriptor);
goto exit;
}
@@ -568,6 +572,7 @@ Return Value:
Status = MmMdAddDescriptorToList(Mdl, NtDescriptor, MDL_OPERATION_FLAGS_TRUNCATE);
if (!NT_SUCCESS(Status)) {
MmMdFreeDescriptor(NtDescriptor);
goto exit;
}
}