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: Igor Kulchytskyy <[email protected]>
Signed-off-by: Mike Maslenkin <[email protected]>
Reviewed-by: Nickle Wang <[email protected]>
Reviewed-by: Abner Chang <[email protected]>
  • Loading branch information
ghbaccount committed Dec 21, 2023
1 parent 50df45a commit c468a26
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 c468a26

Please sign in to comment.