Skip to content

RDK-56115 - Fix coverity issues in RRD [High] #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

Abhinavpv28
Copy link
Contributor

Reason for change: Fix coverity issues in RRD
Test Procedure: Basic Sanity, Focused regression
Risks: Low
Signed-off-by: Abhinav P V [email protected]

@Abhinavpv28 Abhinavpv28 requested review from a team as code owners March 22, 2025 16:02
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -252,6 +252,7 @@ void _rdmManagerEventHandler(const char *owner, IARM_EventId_t eventId, void *da
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Invalid Owner Name found %s, use IARM_BUS_RDMMGR_NAME!!! \n", __FUNCTION__, __LINE__, owner);
}
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: ...Exiting...\n", __FUNCTION__, __LINE__);
free(sendbuf);
Copy link

@rdkcmf-jenkins rdkcmf-jenkins Mar 22, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Uninitialized pointer read

Using uninitialized value "sendbuf" when calling "free".

High Impact, CWE-457
UNINIT

@@ -553,6 +554,7 @@ void checkIssueNodeInfo(issueNodeData *issuestructNode, cJSON *jsoncfg, data_buf
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: No Command excuted as RRD Failed to change directory:%s\n",__FUNCTION__,__LINE__,outdir);
}
}
free(rfcbuf); //CID 320504: Resource leak (RESOURCE_LEAK)
Copy link

@rdkcmf-jenkins rdkcmf-jenkins Mar 22, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double free

Calling "free" frees pointer "rfcbuf" which has already been freed.

High Impact, CWE-415
USE_AFTER_FREE

@@ -252,6 +252,7 @@ void _rdmManagerEventHandler(const char *owner, IARM_EventId_t eventId, void *da
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Invalid Owner Name found %s, use IARM_BUS_RDMMGR_NAME!!! \n", __FUNCTION__, __LINE__, owner);
}
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: ...Exiting...\n", __FUNCTION__, __LINE__);
free(sendbuf); //CID 328981: Resource leak (RESOURCE_LEAK)
Copy link

@rdkcmf-jenkins rdkcmf-jenkins Mar 22, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Uninitialized pointer read

Using uninitialized value "sendbuf" when calling "free".

High Impact, CWE-457
UNINIT

@@ -553,6 +554,10 @@ void checkIssueNodeInfo(issueNodeData *issuestructNode, cJSON *jsoncfg, data_buf
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: No Command excuted as RRD Failed to change directory:%s\n",__FUNCTION__,__LINE__,outdir);
}
}
if( rfcbuf != NULL )
{
free(rfcbuf); //CID 320504: Resource leak (RESOURCE_LEAK)
Copy link

@rdkcmf-jenkins rdkcmf-jenkins Mar 22, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double free

Calling "free" frees pointer "rfcbuf" which has already been freed.

High Impact, CWE-415
USE_AFTER_FREE

@@ -493,6 +502,10 @@ static void processIssueTypeInInstalledPackage(data_buf *rbuf, issueNodeData *pI
freeParsedJson(jsonParsed);

RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: ...Exiting...\n", __FUNCTION__, __LINE__);
if( dynJSONPath )
{
free(dynJSONPath);
Copy link

@rdkcmf-jenkins rdkcmf-jenkins Mar 22, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double free

Calling "free" frees pointer "dynJSONPath" which has already been freed.

High Impact, CWE-415
USE_AFTER_FREE

@@ -110,7 +110,8 @@ void processIssueTypeEvent(data_buf *rbuf)
}

RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: ...Exiting...\n", __FUNCTION__, __LINE__);
return;
free(cmdMap);
Copy link

@rdkcmf-jenkins rdkcmf-jenkins Mar 22, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Uninitialized pointer read

Using uninitialized value "cmdMap" when calling "free".

High Impact, CWE-457
UNINIT

@@ -110,7 +110,8 @@
}

RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: ...Exiting...\n", __FUNCTION__, __LINE__);
return;
free(cmdMap);
Copy link

@rdkcmf-jenkins rdkcmf-jenkins Mar 22, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double free

Calling "free" frees pointer "cmdMap" which has already been freed.

High Impact, CWE-415
USE_AFTER_FREE

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.

3 participants