mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/RamDiskDxe: fix memory leak on error path.
This patch fixes a leak of memory allocated for the RAM disk in cases when an error occurred while reading contents of a file from disk or RamDiskRegister() returned some error condition. Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
This commit is contained in:
parent
b158dad150
commit
1cc0fae8d9
|
@ -404,7 +404,8 @@ HiiCreateRamDisk (
|
|||
);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto ErrorExit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,7 +432,7 @@ HiiCreateRamDisk (
|
|||
);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
|
||||
return Status;
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -442,6 +443,10 @@ HiiCreateRamDisk (
|
|||
PrivateData->CreateMethod = RamDiskCreateHii;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ErrorExit:
|
||||
gBS->FreePool (StartingAddr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue