]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Variable: Initialize local variable "Variable"
authorKubacki, Michael A </o=Intel/ou=External (FYDIBOHF25SPDLT)/cn=Recipients/cn=3c8b0226e75f4ab08d20c151cb7a8a72>
Thu, 21 Nov 2019 23:02:35 +0000 (07:02 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 25 Nov 2019 14:14:18 +0000 (14:14 +0000)
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>
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c

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