]> git.proxmox.com Git - mirror_edk2.git/commit
ShellPkg/CommandLib: avoid NULL derefence and memory leak
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 10 May 2019 03:24:19 +0000 (11:24 +0800)
committerLiming Gao <liming.gao@intel.com>
Tue, 3 Sep 2019 07:09:50 +0000 (15:09 +0800)
commit8b8e91584555b6193f2099a36502763b47501533
tree864b8d57777e8710cd21e2a81c43d3fad31586a1
parent17f8c9e97d770c74f84194576bcd97322fbed21e
ShellPkg/CommandLib: avoid NULL derefence and memory leak

Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
variable PlatformLang is not defined due to dereferencing gUnicodeCollation
gUnicodeCollation (= NULL) in ShellCommandRegisterCommandName().

Furthermore CommandInit() is leaking PlatformLang if
gUnicodeCollation != NULL.

Close the memory leak and use the first UnicodeCollation instance if
PlatfomLang is not defined.

Fixes: d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper UnicodeCollation
instance")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c