MdeModulePkg/Variable: Initialize local variable "Variable"

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2364

Fixes a new build warning in VS2012 introduced in f8ff4cca7c.

This patch initializes the local variable "Variable" in
VariableServiceGetNextVariableInternal ().

This ensures the pointers in the structure are initialized
in the case no variable stores exist in the list of variable
stores.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
Kubacki, Michael A 2019-11-22 07:02:35 +08:00 committed by mergify[bot]
parent 290a485d60
commit bbb5b0d648
1 changed files with 2 additions and 0 deletions

View File

@ -551,6 +551,8 @@ VariableServiceGetNextVariableInternal (
return EFI_INVALID_PARAMETER;
}
ZeroMem (&Variable, sizeof (Variable));
// Check if the variable exists in the given variable store list
for (StoreType = (VARIABLE_STORE_TYPE) 0; StoreType < VariableStoreTypeMax; StoreType++) {
if (VariableStoreList[StoreType] == NULL) {