Skip to content
20 changes: 13 additions & 7 deletions rfcMgr/rfc_xconf_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,6 @@ void RuntimeFeatureControlProcessor::InitDownloadData(DownloadData *pDwnData)
int RuntimeFeatureControlProcessor::DownloadRuntimeFeatutres(DownloadData *pDwnLoc, DownloadData *pHeaderDwnLoc, const std::string& url_str)
{
int ret_value = FAILURE;
void *curl = nullptr;
hashParam_t *hashParam = nullptr;

int curl_ret_code = -1;
Expand Down Expand Up @@ -1981,14 +1980,21 @@ int RuntimeFeatureControlProcessor::DownloadRuntimeFeatutres(DownloadData *pDwnL
const char *error_msg = curl_easy_strerror(curl_code);
RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] curl_easy_strerror =%s\n", __FUNCTION__, __LINE__, error_msg);

if(curl)
{
doStopDownload(curl);
curl = nullptr;
}
if(file_dwnl.hashData != nullptr)
{
free(file_dwnl.hashData);
hashParam_t* hashData = (hashParam_t*)file_dwnl.hashData;
if (hashData->hashvalue != NULL)
{
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file_dwnl.hashData is cleaned up at the end of the function, but there are multiple early return paths above (e.g., cert selector init failure / getMtlscert failures, and the branch where pDwnLoc->pvOut / pHeaderDwnLoc->pvOut are null) that bypass this cleanup and leak hashParam (and its strdup’d members). Consider refactoring to a single exit path (e.g., goto cleanup/RAII) so hashData is freed on all returns.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

free(hashData->hashvalue);
hashData->hashvalue = NULL;
}
if (hashData->hashtime != NULL)
{
free(hashData->hashtime);
hashData->hashtime = NULL;
}
free(hashData);
file_dwnl.hashData = nullptr;
}

if (_url_validation_in_progress)
Expand Down
Loading