Skip to content

Commit

Permalink
RedfishClientPkg: fix access to unitialized variable.
Browse files Browse the repository at this point in the history
It is possible that at the time of accessing to AsciiLocation pointer
the memory is not allocated.

Also gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) emits a warning for
this case:

RedfishFeatureUtilityLib.c:1889:37: error: 'AsciiLocation' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       *Location = StrAsciiToUnicode (AsciiLocation);

Cc: Abner Chang <[email protected]>
Cc: Igor Kulchytskyy <[email protected]>
Signed-off-by: Mike Maslenkin <[email protected]>
Reviewed-by: Nickle Wang <[email protected]>
  • Loading branch information
ghbaccount committed Dec 19, 2023
1 parent ef8d18f commit 3f9d119
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,8 @@ GetEtagAndLocation (
}

if (Location != NULL) {
*Location = NULL;
*Location = NULL;
AsciiLocation = NULL;

if (*(Response->StatusCode) == HTTP_STATUS_200_OK) {
Header = HttpFindHeader (Response->HeaderCount, Response->Headers, HTTP_HEADER_LOCATION);
Expand Down

0 comments on commit 3f9d119

Please sign in to comment.