Skip to content

Commit

Permalink
MdeModulePkg: DeviceManagerUiLib: Fix using uninitialized variable
Browse files Browse the repository at this point in the history
There could a path where the variable is used without being initialized.

This change initialized the variable at the function entry.

Cc: Liming Gao <[email protected]>
Cc: Zhichao Gao <[email protected]>
Cc: Ray Ni <[email protected]>
Signed-off-by: Kun Qin <[email protected]>
  • Loading branch information
kuqin12 committed Jun 6, 2024
1 parent c0aa7e0 commit 4298c31
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ CreateDeviceManagerForm (
TempSize = 0;
BufferSize = 0;
Buffer = NULL;
HiiHandles = NULL; // MU_CHANGE - Initialize HiiHandles to NULL

HiiHandle = gDeviceManagerPrivate.HiiHandle;
AddNetworkMenu = FALSE;
Expand Down Expand Up @@ -758,7 +759,10 @@ CreateDeviceManagerForm (
HiiFreeOpCodeHandle (StartOpCodeHandle);
}

FreePool (HiiHandles);
// MU_CHANGE: Only free HiiHandles if it is not NULL
if (HiiHandles != NULL) {
FreePool (HiiHandles);
}
}

/**
Expand Down

0 comments on commit 4298c31

Please sign in to comment.