Hello,
In the code below, cppcheck detect a missing va_end() on 'valistParam'. I think it is a mistake.
void amtxnSetReqError(amtxn ptxn, int iLastRc, int32_t iErrorCode, int32_t iArgsNum, /char arg1, argn/... ) { va_list valistParam; int iCpt; char pzcTmpChar; char pzcTmpBuff; int iIncrSize = 512; int iSize; int iLen = 0;
othreadSemLock(ptxn->psemSync); ptxn->iRc = iLastRc; ptxn->iErrorCode = iErrorCode; if (iArgsNum != 0) { /* realloc of ptxn->pzcErrorArgs */ if (ptxn->pzcErrorArgs != NULL) { free(ptxn->pzcErrorArgs); ptxn->pzcErrorArgs = NULL; } /* FIXME utiliser opoolalloc */ ptxn->pzcErrorArgs = calloc(iIncrSize, sizeof (char)); pzcTmpBuff = ptxn->pzcErrorArgs; iSize = 0; va_start(valistParam, iArgsNum); /* Initialize variable arguments. */ for (iCpt = 0; iCpt < iArgsNum; iCpt++) { pzcTmpChar = va_arg(valistParam, char*); if (pzcTmpChar != NULL) { iLen = strlen(pzcTmpChar); } if ((pzcTmpChar != NULL) && ((iSize + iLen) < iIncrSize)) { if (iCpt != 0) { *pzcTmpBuff = AMCORE_LOG_ERR_SEPARATOR; pzcTmpBuff += 1; iSize += 1; } strcpy(pzcTmpBuff, pzcTmpChar); pzcTmpBuff += iLen; iSize += iLen; } else { break; } } va_end(valistParam); /* Reset variable arguments. */ } othreadSemUnlock(ptxn->psemSync, 0);
}
Thanks,
I can't reproduce this with 2.3.
Log in to post a comment.
Hello,
In the code below, cppcheck detect a missing va_end() on 'valistParam'. I think it is a mistake.
void amtxnSetReqError(amtxn ptxn,
int iLastRc,
int32_t iErrorCode,
int32_t iArgsNum,
/char arg1, argn/...
)
{
va_list valistParam;
int iCpt;
char pzcTmpChar;
char pzcTmpBuff;
int iIncrSize = 512;
int iSize;
int iLen = 0;
}
Thanks,
I can't reproduce this with 2.3.