Tested-by: Daniil Egranov <daniil.egranov@arm.com>
Fix a case where MarvellYukonDriverStart attempted to free a buffer before it was allocated. Fix another case where the function returned without freeing the same buffer. Also correct the error message for that case, which was copied verbatim from the preceding if-statement. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> --- Drivers/Net/MarvellYukonDxe/DriverBinding.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Drivers/Net/MarvellYukonDxe/DriverBinding.c b/Drivers/Net/MarvellYukonDxe/DriverBinding.c index 947d738b10..cbe8ad34e4 100644 --- a/Drivers/Net/MarvellYukonDxe/DriverBinding.c +++ b/Drivers/Net/MarvellYukonDxe/DriverBinding.c @@ -127,7 +127,6 @@ MarvellYukonDriverStart ( if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Marvell Yukon: OpenProtocol: EFI_PCI_IO_PROTOCOL ERROR Status = %r\n", Status)); - gBS->FreePool (YukonDriver); return Status; } @@ -156,7 +155,8 @@ MarvellYukonDriverStart ( } if (ScData->msk_if[Port] == NULL) { - DEBUG ((DEBUG_ERROR, "Marvell Yukon: AllocatePool() failed with Status = %r\n", EFI_BAD_BUFFER_SIZE)); + DEBUG ((DEBUG_ERROR, "Marvell Yukon: invalid buffer size\n")); + gBS->FreePool (YukonDriver); return EFI_BAD_BUFFER_SIZE; }