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
1 changed files with 13 additions and 6 deletions

View File

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