Skip to content

[DELIA-68036] RRD failing in device for some commands, getting invalid message type (SCXI11BEI) #121

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 14 commits into
base: develop
Choose a base branch
from
19 changes: 16 additions & 3 deletions src/rrdEventProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,28 @@ void processIssueTypeEvent(data_buf *rbuf)
{
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Memory Allocation Failed... \n", __FUNCTION__, __LINE__);
}
free(cmdBuff);
if(cmdBuff)
{
free(cmdBuff);
cmdBuff = NULL;
}
}
else
{
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Memory Allocation Failed... \n", __FUNCTION__, __LINE__);
}
free(cmdMap[index]);
if( cmdMap[index])
{
free(cmdMap[index]);
cmdMap[index] = NULL;
}

}
free(cmdMap);
if( cmdMap)
{
free(cmdMap);
cmdMap = NULL;
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/rrdInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,15 @@ void _remoteDebuggerEventHandler(rbusHandle_t handle, rbusEvent_t const* event,
return;
}

int len = strlen(rbusValue_GetString(value, NULL));
int len = strlen(rbusValue_GetString(value, NULL))+1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please cross check rbusValue_GetString definition.
I believe it already allocates and returns you a buffer . If that is the case the lines till 337 might be redundant . Also we might be having memleak in case allocated but is not released.

dataMsg = (char *) calloc(1, len);
if(!dataMsg)
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Memory Allocation Failed for %s \n", __FUNCTION__, __LINE__, rbusValue_ToString(value, NULL, 0));
return;
}
strncpy(dataMsg, rbusValue_GetString(value, NULL), len);
strncpy(dataMsg, rbusValue_GetString(value, NULL), len-1);
dataMsg[len-1]='\0';
if (dataMsg[0] == '\0' || len <= 0 )
{
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Message Received is empty, Exit Processing!!! \n", __FUNCTION__, __LINE__);
Expand Down
Loading