mirror of
https://github.com/acidanthera/audk.git
synced 2025-09-23 09:47:44 +02:00
ImageTool: Fix memory leaks
This commit is contained in:
parent
d5eb795bc9
commit
31c0046cbe
@ -166,6 +166,7 @@ ToolImageEmit (
|
||||
|
||||
if (OutputFile == NULL) {
|
||||
DEBUG_RAISE ();
|
||||
ToolImageDestruct (&ImageInfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -175,6 +176,7 @@ ToolImageEmit (
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
assert (false);
|
||||
FreePool (OutputFile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,7 @@ ToolContextConstructUefiImage (
|
||||
Success = ScanUefiImageGetHeaderInfo (&Image->HeaderInfo, &Context);
|
||||
if (!Success) {
|
||||
fprintf (stderr, "ImageTool: Could not retrieve header info\n");
|
||||
ToolImageDestruct (Image);
|
||||
FreeAlignedPages (Destination, DestinationPages);
|
||||
return RETURN_VOLUME_CORRUPTED;
|
||||
}
|
||||
@ -245,6 +246,7 @@ ToolContextConstructUefiImage (
|
||||
Success = ScanUefiImageGetSegmentInfo (&Image->SegmentInfo, &Context);
|
||||
if (!Success) {
|
||||
fprintf (stderr, "ImageTool: Could not retrieve segment info\n");
|
||||
ToolImageDestruct (Image);
|
||||
FreeAlignedPages (Destination, DestinationPages);
|
||||
return RETURN_VOLUME_CORRUPTED;
|
||||
}
|
||||
@ -252,6 +254,7 @@ ToolContextConstructUefiImage (
|
||||
Success = ScanUefiImageGetRelocInfo (&Image->RelocInfo, &Context);
|
||||
if (!Success) {
|
||||
fprintf (stderr, "ImageTool: Could not retrieve reloc info\n");
|
||||
ToolImageDestruct (Image);
|
||||
FreeAlignedPages (Destination, DestinationPages);
|
||||
return RETURN_VOLUME_CORRUPTED;
|
||||
}
|
||||
@ -259,6 +262,7 @@ ToolContextConstructUefiImage (
|
||||
Success = ScanUefiImageGetHiiInfo (&Image->HiiInfo, &Context);
|
||||
if (!Success) {
|
||||
fprintf (stderr, "ImageTool: Could not retrieve HII info\n");
|
||||
ToolImageDestruct (Image);
|
||||
FreeAlignedPages (Destination, DestinationPages);
|
||||
return RETURN_VOLUME_CORRUPTED;
|
||||
}
|
||||
@ -266,6 +270,7 @@ ToolContextConstructUefiImage (
|
||||
Success = ScanUefiImageGetDebugInfo (&Image->DebugInfo, &Context);
|
||||
if (!Success) {
|
||||
fprintf (stderr, "ImageTool: Could not retrieve debug info\n");
|
||||
ToolImageDestruct (Image);
|
||||
FreeAlignedPages (Destination, DestinationPages);
|
||||
return RETURN_VOLUME_CORRUPTED;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user