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