mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 09:04:07 +02:00
RedfishPkg: fix memory leak issue
The calloc memory is not free when function collectionEvalOp return in the halfway. Cc: Abner Chang <abner.chang@hpe.com> Cc: Nickle Wang <nickle.wang@hpe.com> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com> Reviewed-by: Abner Chang <abner.chang@hpe.com>
This commit is contained in:
parent
f06941cc46
commit
2b175eeb6a
@ -620,6 +620,7 @@ collectionEvalOp (
|
|||||||
if (((*StatusCode == NULL) && (members == NULL)) ||
|
if (((*StatusCode == NULL) && (members == NULL)) ||
|
||||||
((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT))))
|
((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT))))
|
||||||
{
|
{
|
||||||
|
free (valid);
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,6 +634,7 @@ collectionEvalOp (
|
|||||||
if (((*StatusCode == NULL) && (tmp == NULL)) ||
|
if (((*StatusCode == NULL) && (tmp == NULL)) ||
|
||||||
((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT))))
|
((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT))))
|
||||||
{
|
{
|
||||||
|
free (valid);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,19 +660,15 @@ collectionEvalOp (
|
|||||||
|
|
||||||
cleanupPayload (members);
|
cleanupPayload (members);
|
||||||
if (validCount == 0) {
|
if (validCount == 0) {
|
||||||
free (valid);
|
ret = NULL;
|
||||||
return NULL;
|
} else if (validCount == 1) {
|
||||||
}
|
|
||||||
|
|
||||||
if (validCount == 1) {
|
|
||||||
ret = valid[0];
|
ret = valid[0];
|
||||||
free (valid);
|
|
||||||
return ret;
|
|
||||||
} else {
|
} else {
|
||||||
ret = createCollection (payload->service, validCount, valid);
|
ret = createCollection (payload->service, validCount, valid);
|
||||||
free (valid);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free (valid);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static redfishPayload *
|
static redfishPayload *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user