Merge pull request #2064 from rgerhards/coverity-false-positives

"fix" Coverity false positives
This commit is contained in:
Rainer Gerhards 2017-11-21 13:10:42 +01:00 committed by GitHub
commit cf22e85c59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 19 deletions

View File

@ -4768,10 +4768,7 @@ rmLeadingSpace(char *s)
rsRetVal rsRetVal
initRainerscript(void) initRainerscript(void)
{ {
DEFiRet; return objGetObjInterface(&obj);
CHKiRet(objGetObjInterface(&obj));
finalize_it:
RETiRet;
} }
/* we need a function to check for octal digits */ /* we need a function to check for octal digits */

View File

@ -247,8 +247,7 @@ doInjectNumericSuffixMsg(int iNum, ratelimit_t *ratelimiter)
DEFiRet; DEFiRet;
snprintf((char*)szMsg, sizeof(szMsg)/sizeof(uchar), snprintf((char*)szMsg, sizeof(szMsg)/sizeof(uchar),
"<167>Mar 1 01:00:00 172.20.245.8 tag msgnum:%8.8d:", iNum); "<167>Mar 1 01:00:00 172.20.245.8 tag msgnum:%8.8d:", iNum);
CHKiRet(doInjectMsg(szMsg, ratelimiter)); iRet = doInjectMsg(szMsg, ratelimiter);
finalize_it:
RETiRet; RETiRet;
} }

View File

@ -554,7 +554,7 @@ CODESTARTnewInpInst
inst->topic, inst->topic,
inst->consumergroup); inst->consumergroup);
CHKiRet(checkInstance(inst)); iRet = checkInstance(inst);
finalize_it: finalize_it:
CODE_STD_FINALIZERnewInpInst CODE_STD_FINALIZERnewInpInst
cnfparamvalsDestruct(pvals, &inppblk); cnfparamvalsDestruct(pvals, &inppblk);

View File

@ -638,7 +638,7 @@ CODESTARTactivateCnfPrePrivDrop
} }
if(pOurTcpsrv == NULL) if(pOurTcpsrv == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN); ABORT_FINALIZE(RS_RET_NO_RUN);
CHKiRet(tcpsrv.ConstructFinalize(pOurTcpsrv)); iRet = tcpsrv.ConstructFinalize(pOurTcpsrv);
finalize_it: finalize_it:
ENDactivateCnfPrePrivDrop ENDactivateCnfPrePrivDrop

View File

@ -692,7 +692,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
"mmexternal supports only v6+ config format, use: " "mmexternal supports only v6+ config format, use: "
"action(type=\"mmexternal\" binary=...)"); "action(type=\"mmexternal\" binary=...)");
} }
ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED); iRet = RS_RET_CONFLINE_UNPROCESSED;
CODE_STD_FINALIZERparseSelectorAct CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct ENDparseSelectorAct
@ -701,8 +701,7 @@ BEGINmodExit
CODESTARTmodExit CODESTARTmodExit
free(cs.szBinary); free(cs.szBinary);
cs.szBinary = NULL; cs.szBinary = NULL;
CHKiRet(objRelease(errmsg, CORE_COMPONENT)); iRet = objRelease(errmsg, CORE_COMPONENT);
finalize_it:
ENDmodExit ENDmodExit

View File

@ -188,5 +188,5 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr CODEmodInit_QueryRegCFSLineHdlr
DBGPRINTF("mmrm1stspace: module compiled with rsyslog version %s.\n", VERSION); DBGPRINTF("mmrm1stspace: module compiled with rsyslog version %s.\n", VERSION);
CHKiRet(objUse(errmsg, CORE_COMPONENT)); iRet = objUse(errmsg, CORE_COMPONENT);
ENDmodInit ENDmodInit

View File

@ -738,8 +738,7 @@ CODESTARTcreateWrkrInstance
pWrkrData->fdOutputFile = -1; pWrkrData->fdOutputFile = -1;
pWrkrData->bIsRunning = 0; pWrkrData->bIsRunning = 0;
CHKiRet(startChild(pWrkrData)); iRet = startChild(pWrkrData);
finalize_it:
ENDcreateWrkrInstance ENDcreateWrkrInstance

View File

@ -1220,6 +1220,10 @@ glblDoneLoadCnf(void)
} else if(!strcmp(paramblk.descr[i].name, "debug.logfile")) { } else if(!strcmp(paramblk.descr[i].name, "debug.logfile")) {
if(pszAltDbgFileName == NULL) { if(pszAltDbgFileName == NULL) {
pszAltDbgFileName = es_str2cstr(cnfparamvals[i].val.d.estr, NULL); pszAltDbgFileName = es_str2cstr(cnfparamvals[i].val.d.estr, NULL);
/* can actually happen if debug system also opened altdbg */
if(altdbg != -1) {
close(altdbg);
}
if((altdbg = open(pszAltDbgFileName, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY if((altdbg = open(pszAltDbgFileName, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY
|O_CLOEXEC, S_IRUSR|S_IWUSR)) == -1) { |O_CLOEXEC, S_IRUSR|S_IWUSR)) == -1) {
errmsg.LogError(0, RS_RET_ERR, "debug log file '%s' could not be opened", errmsg.LogError(0, RS_RET_ERR, "debug log file '%s' could not be opened",

View File

@ -63,7 +63,6 @@ ENDobjConstruct(netstrm)
/* destructor for the netstrm object */ /* destructor for the netstrm object */
BEGINobjDestruct(netstrm) /* be sure to specify the object type also in END and CODESTART macros! */ BEGINobjDestruct(netstrm) /* be sure to specify the object type also in END and CODESTART macros! */
CODESTARTobjDestruct(netstrm) CODESTARTobjDestruct(netstrm)
//printf("destruct driver data %p\n", pThis->pDrvrData);
if(pThis->pDrvrData != NULL) if(pThis->pDrvrData != NULL)
iRet = pThis->Drvr.Destruct(&pThis->pDrvrData); iRet = pThis->Drvr.Destruct(&pThis->pDrvrData);
ENDobjDestruct(netstrm) ENDobjDestruct(netstrm)
@ -73,11 +72,8 @@ ENDobjDestruct(netstrm)
static rsRetVal static rsRetVal
netstrmConstructFinalize(netstrm_t *pThis) netstrmConstructFinalize(netstrm_t *pThis)
{ {
DEFiRet;
ISOBJ_TYPE_assert(pThis, netstrm); ISOBJ_TYPE_assert(pThis, netstrm);
CHKiRet(pThis->Drvr.Construct(&pThis->pDrvrData)); return pThis->Drvr.Construct(&pThis->pDrvrData);
finalize_it:
RETiRet;
} }
/* abort a connection. This is much like Destruct(), but tries /* abort a connection. This is much like Destruct(), but tries