ShellPkg: Verify DevicePathToText was successful before using the resultant pointer.

signed-off-by: jcarsey
reviewed-by: darylm503

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12393 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2011-09-20 23:06:23 +00:00
parent 1fc3749dad
commit eca218a7ce

View File

@ -13,6 +13,7 @@
**/ **/
#include <Uefi.h> #include <Uefi.h>
#include <ShellBase.h>
#include <Protocol/UnicodeCollation.h> #include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePath.h> #include <Protocol/DevicePath.h>
@ -251,13 +252,19 @@ DevicePathCompare (
FALSE, FALSE,
FALSE); FALSE);
RetVal = mUnicodeCollation->StriColl( if (TextPath1 == NULL) {
mUnicodeCollation, RetVal = -1;
TextPath1, } else if (TextPath2 == NULL) {
TextPath2); RetVal = 1;
} else {
RetVal = mUnicodeCollation->StriColl(
mUnicodeCollation,
TextPath1,
TextPath2);
}
FreePool(TextPath1); SHELL_FREE_NON_NULL(TextPath1);
FreePool(TextPath2); SHELL_FREE_NON_NULL(TextPath2);
return (RetVal); return (RetVal);
} }