Skip to content

Conversation

@Vismalskumar0
Copy link
Contributor

RDK-60308-[tr69hostif, RFC] RDK Coverity Defect Resolution for Device Management

… Management

RDK-60308-[tr69hostif, RFC] RDK Coverity Defect Resolution for Device Management
@Vismalskumar0 Vismalskumar0 requested a review from a team as a code owner January 27, 2026 12:24
Copilot AI review requested due to automatic review settings January 27, 2026 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR appears to target Coverity findings in the RFC/XConf handler, focusing on memory handling, logging robustness, and minor efficiency tweaks in Device Management.

Changes:

  • Added <errno.h> and refined IsDirectBlocked() to treat ENOENT as non-fatal when removing the direct-block file, while logging detailed errno information on failure.
  • Reduced unnecessary string copies by using std::move when passing temporary or last-use std::string instances into helper methods and containers.
  • Tightened memory management around hashParam_t in DownloadRuntimeFeatutres() by explicitly freeing nested heap-allocated members and nulling pointers, and made the cURL error telemetry switch exhaustive with break/default handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1990 to +2003
if(file_dwnl.hashData != nullptr)
{
if(file_dwnl.hashData->hashvalue != nullptr)
{
free(file_dwnl.hashData->hashvalue);
file_dwnl.hashData->hashvalue = nullptr;
}
if(file_dwnl.hashData->hashtime != nullptr)
{
free(file_dwnl.hashData->hashtime);
file_dwnl.hashData->hashtime = nullptr;
}
free(file_dwnl.hashData);
file_dwnl.hashData = nullptr;
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

hashParam and its inner allocations are only freed via file_dwnl.hashData on the main success path, but there are several earlier return paths in this function (e.g., MTLS cert failures, cert selector init failure, or the case where pDwnLoc->pvOut/pHeaderDwnLoc->pvOut are null) that exit without hitting this cleanup, leaking both the hashParam_t struct and any strdup-allocated strings. Consider centralizing cleanup (e.g., a single exit path with a cleanup block or a small RAII helper) so that hashParam->hashvalue, hashParam->hashtime, and hashParam are released consistently on all return paths, including error conditions and the !pDwnLoc->pvOut || !pHeaderDwnLoc->pvOut case.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants