From c468a26290d0def95166874a14678ba75f01075b Mon Sep 17 00:00:00 2001 From: Mike Maslenkin Date: Fri, 8 Dec 2023 03:13:10 +0300 Subject: [PATCH] RedfishClientPkg: fix access to unitialized variable. 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 Signed-off-by: Mike Maslenkin Reviewed-by: Nickle Wang Reviewed-by: Abner Chang --- .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c index 0f0b050d7..01c054ae3 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c @@ -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);