MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure
authorStar Zeng <>
Thu, 14 Sep 2017 10:52:22 +0000 (18:52 +0800)
committerStar Zeng <>
Fri, 15 Sep 2017 01:26:24 +0000 (09:26 +0800)
VS2010/VS2012 build failure with below info:
warning C4701:
  potentially uninitialized local variable 'DataOffset' used
  potentially uninitialized local variable 'FilePosition' used
  potentially uninitialized local variable 'FinishedSeeking' used
  potentially uninitialized local variable 'Data' used
warning C4703:
  potentially uninitialized local pointer variable 'Data' used

In fact, DataOffset, FilePosition and FinishedSeeking are initialized
and then used if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ).
DoFreeAed will be set to TRUE when Data is allocated and returned from
GetAedAdsData(), and Data will be freed if (DoFreeAed) when exiting.

Use same method at 5afa5b815936e2b45a375b6521764195bed68680 to fix
the build failure.

There is related discussion at

Cc: Laszlo Ersek <>
Cc: Eric Dong <>
Cc: Paulo Alcantara <>
Cc: Ruiyu Ni <>
Cc: Liming Gao <>
Cc: Dandan Bi <>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <>
Reviewed-by: Paulo Alcantara <>

index 9ec81a6cdcb4b0741b7a77c2e2b95e9b4fde087c..4609580b30160c1cf3795a1e75dc9cfba923fd56 100644 (file)
@@ -897,6 +897,10 @@ ReadFile (
   // set BytesLeft to suppress incorrect compiler/analyzer warnings\r
   BytesLeft = 0;\r
+  DataOffset = 0;\r
+  FilePosition = 0;\r
+  FinishedSeeking = FALSE;\r
+  Data = NULL;\r
   switch (ReadFileInfo->Flags) {\r