Clean up the gBS sevice (CopyMem, SetMem, AllocatePool, FreePool) with the corresponding APIs defined in Mde library class for these modules.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2456 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -11,7 +11,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
DevicePathDriver.h
|
||||
DevicePath.h
|
||||
|
||||
Abstract:
|
||||
Definition for Device Path Utilities driver
|
||||
|
@@ -6,8 +6,9 @@
|
||||
<GuidValue>9B680FCE-AD6B-4F3A-B60B-F59899003443</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for Device Path Driver.</Abstract>
|
||||
<Description>This driver is for DevicePathUtilities, DevicePahtToText and DevicePathFromText</Description>
|
||||
<Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
|
||||
<Description>This driver implement these three UEFI deveice path protocols (
|
||||
DevicePathUtilities, DevicePahtToText and DevicePathFromText) and install them.</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -22,18 +23,17 @@
|
||||
<OutputFileBasename>DevicePath</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
<HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
<HelpText>Recommended libary Instance is BasePrintLib instance in MdePkg.</HelpText>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
@@ -46,8 +46,9 @@
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
<HelpText>Recommended libary Instance is UefiDevicePathLib instance in MdePkg.</HelpText>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PcdLib</Keyword>
|
||||
@@ -68,9 +69,6 @@
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">
|
||||
<ProtocolCName>gEfiDevicePathUtilitiesProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
@@ -103,13 +101,13 @@
|
||||
</Extern>
|
||||
</Externs>
|
||||
<PcdCoded>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_PRODUCED">
|
||||
<C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<DefaultValue>FALSE</DefaultValue>
|
||||
<HelpText>If TRUE, then the Device Path To Text Protocol should be produced by the platform</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_PRODUCED">
|
||||
<C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<DefaultValue>FALSE</DefaultValue>
|
||||
|
@@ -2277,10 +2277,10 @@ ConvertTextToDeviceNode (
|
||||
DeviceNode = DumpNode (DeviceNodeStr);
|
||||
} else {
|
||||
DeviceNode = DumpNode (ParamStr);
|
||||
gBS->FreePool (ParamStr);
|
||||
FreePool (ParamStr);
|
||||
}
|
||||
|
||||
gBS->FreePool (DeviceNodeStr);
|
||||
FreePool (DeviceNodeStr);
|
||||
|
||||
return DeviceNode;
|
||||
}
|
||||
@@ -2346,12 +2346,12 @@ ConvertTextToDevicePath (
|
||||
DeviceNode = DumpNode (DeviceNodeStr);
|
||||
} else {
|
||||
DeviceNode = DumpNode (ParamStr);
|
||||
gBS->FreePool (ParamStr);
|
||||
FreePool (ParamStr);
|
||||
}
|
||||
|
||||
NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode);
|
||||
gBS->FreePool (DevicePath);
|
||||
gBS->FreePool (DeviceNode);
|
||||
FreePool (DevicePath);
|
||||
FreePool (DeviceNode);
|
||||
DevicePath = NewDevicePath;
|
||||
|
||||
if (IsInstanceEnd) {
|
||||
@@ -2359,12 +2359,12 @@ ConvertTextToDevicePath (
|
||||
SetDevicePathInstanceEndNode (DeviceNode);
|
||||
|
||||
NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode);
|
||||
gBS->FreePool (DevicePath);
|
||||
gBS->FreePool (DeviceNode);
|
||||
FreePool (DevicePath);
|
||||
FreePool (DeviceNode);
|
||||
DevicePath = NewDevicePath;
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (DevicePathStr);
|
||||
FreePool (DevicePathStr);
|
||||
return DevicePath;
|
||||
}
|
||||
|
@@ -132,7 +132,7 @@ ReallocatePool (
|
||||
CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
|
||||
}
|
||||
|
||||
gBS->FreePool (OldPool);
|
||||
FreePool (OldPool);
|
||||
}
|
||||
|
||||
return NewPool;
|
||||
@@ -196,7 +196,7 @@ CatPrint (
|
||||
Str->Len = Size - sizeof (UINT16);
|
||||
}
|
||||
|
||||
gBS->FreePool (AppendStr);
|
||||
FreePool (AppendStr);
|
||||
return Str->Str;
|
||||
}
|
||||
|
||||
@@ -1488,7 +1488,7 @@ ConvertDevicePathToText (
|
||||
//
|
||||
// Shrink pool used for string allocation
|
||||
//
|
||||
gBS->FreePool (UnpackDevPath);
|
||||
FreePool (UnpackDevPath);
|
||||
|
||||
NewSize = (Str.Len + 1) * sizeof (CHAR16);
|
||||
Str.Str = ReallocatePool (Str.Str, NewSize, NewSize);
|
||||
|
Reference in New Issue
Block a user