Blame SOURCES/rsyslog-8.2102.0-rhbz1938863-covscan.patch

000b35
diff -up rsyslog-8.2102.0/contrib/imdocker/imdocker.c.covscan rsyslog-8.2102.0/contrib/imdocker/imdocker.c
000b35
--- rsyslog-8.2102.0/contrib/imdocker/imdocker.c.covscan	2021-01-18 11:21:14.000000000 +0100
000b35
+++ rsyslog-8.2102.0/contrib/imdocker/imdocker.c	2021-07-22 14:10:31.877231143 +0200
000b35
@@ -1527,6 +1527,7 @@ process_json(sbool isInit, const char* j
000b35
 									pInstances->last_container_id,
000b35
 									(unsigned)pInstances->last_container_created);
000b35
 						}
000b35
+						// coverity[leaked_storage : FALSE]
000b35
 						CHKiRet(dockerContLogsInstSetUrlById(isInit, pInst,
000b35
 									pInstances->curlm, containerId));
000b35
 						CHKiRet(dockerContLogReqsAdd(pInstances, pInst));
000b35
diff -up rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c.covscan rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c
000b35
--- rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c.covscan	2020-10-03 19:06:47.000000000 +0200
000b35
+++ rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c	2021-07-22 14:10:31.877231143 +0200
000b35
@@ -324,7 +324,6 @@ BEGINnewActInst
000b35
 	struct cnfparamvals *pvals;
000b35
 	int i;
000b35
 	int iNumTpls;
000b35
-	uchar *keydup = NULL;
000b35
 CODESTARTnewActInst
000b35
 	if((pvals = nvlstGetParams(lst, &actpblk, NULL)) == NULL)
000b35
 		ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
000b35
@@ -417,14 +416,11 @@ CODESTARTnewActInst
000b35
 	CHKiRet(OMSRsetEntry(*ppOMSR, 0, (uchar*)pData->tplName, OMSR_NO_RQD_TPL_OPTS));
000b35
 
000b35
 	if (pData->dynaKey) {
000b35
-		CHKmalloc(keydup = ustrdup(pData->key));
000b35
 		CHKiRet(OMSRsetEntry(*ppOMSR, 1, ustrdup(pData->key), OMSR_NO_RQD_TPL_OPTS));
000b35
-		keydup = NULL; /* handed over */
000b35
 	}
000b35
 
000b35
 CODE_STD_FINALIZERnewActInst
000b35
 	cnfparamvalsDestruct(pvals, &actpblk);
000b35
-	free(keydup);
000b35
 ENDnewActInst
000b35
 
000b35
 
000b35
diff -up rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c.covscan rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c
000b35
--- rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c.covscan	2021-01-18 11:21:14.000000000 +0100
000b35
+++ rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c	2021-07-22 14:10:31.877231143 +0200
000b35
@@ -778,6 +778,7 @@ static rsRetVal publishRabbitMQ(wrkrInst
000b35
 		ABORT_FINALIZE(RS_RET_RABBITMQ_CONN_ERR);
000b35
 	}
000b35
 
000b35
+	// coverity[identical_branches : FALSE]
000b35
 	if (manage_error(amqp_basic_publish(self->a_conn, 1, exchange, routing_key,
000b35
 			0, 0, p_amqp_props, body_bytes), "amqp_basic_publish")) {
000b35
 		/* error already notified */
000b35
diff -up rsyslog-8.2102.0/grammar/rainerscript.c.covscan rsyslog-8.2102.0/grammar/rainerscript.c
000b35
--- rsyslog-8.2102.0/grammar/rainerscript.c.covscan	2021-02-15 12:06:16.000000000 +0100
000b35
+++ rsyslog-8.2102.0/grammar/rainerscript.c	2021-07-22 14:10:31.878231140 +0200
000b35
@@ -2814,7 +2814,7 @@ evalVar(struct cnfvar *__restrict__ cons
000b35
 		if(bMustBeFreed)
000b35
 			free(pszProp);
000b35
 	}
000b35
-
000b35
+	// coverity[leaked_storage : FALSE]
000b35
 }
000b35
 
000b35
 /* perform a string comparision operation against a while array. Semantic is
000b35
diff -up rsyslog-8.2102.0/plugins/imfile/imfile.c.covscan rsyslog-8.2102.0/plugins/imfile/imfile.c
000b35
--- rsyslog-8.2102.0/plugins/imfile/imfile.c.covscan	2021-01-18 11:21:14.000000000 +0100
000b35
+++ rsyslog-8.2102.0/plugins/imfile/imfile.c	2021-07-22 14:10:31.878231140 +0200
000b35
@@ -1278,6 +1278,7 @@ static void ATTR_NONNULL(1)
000b35
 getFileID(act_obj_t *const act)
000b35
 {
000b35
 	char tmp_id[FILE_ID_HASH_SIZE];
000b35
+	// coverity[buffer_size_warning : FALSE]
000b35
 	strncpy(tmp_id, (const char*)act->file_id, FILE_ID_HASH_SIZE);
000b35
 	act->file_id[0] = '\0';
000b35
 	assert(act->fd >= 0); /* fd must have been opened at act_obj_t creation! */
000b35
@@ -1290,6 +1291,7 @@ getFileID(act_obj_t *const act)
000b35
 		DBGPRINTF("getFileID partial or error read, ret %d\n", r);
000b35
 	}
000b35
 	if (strncmp(tmp_id, act->file_id, FILE_ID_HASH_SIZE)) {/* save the old id for cleaning purposes */
000b35
+		// coverity[buffer_size_warning : FALSE]
000b35
 		strncpy(act->file_id_prev, tmp_id, FILE_ID_HASH_SIZE);
000b35
 	}
000b35
 	DBGPRINTF("getFileID for '%s', file_id_hash '%s'\n", act->name, act->file_id);
000b35
@@ -1544,6 +1546,7 @@ openFileWithoutStateFile(act_obj_t *cons
000b35
 		const int fd = open(act->name, O_RDONLY | O_CLOEXEC);
000b35
 		if(fd >= 0) {
000b35
 			act->pStrm->iCurrOffs = lseek64(fd, 0, SEEK_END);
000b35
+			close(fd);
000b35
 			if(act->pStrm->iCurrOffs < 0) {
000b35
 				act->pStrm->iCurrOffs = 0;
000b35
 				LogError(errno, RS_RET_ERR, "imfile: could not query current "
000b35
diff -up rsyslog-8.2102.0/plugins/imptcp/imptcp.c.covscan rsyslog-8.2102.0/plugins/imptcp/imptcp.c
000b35
--- rsyslog-8.2102.0/plugins/imptcp/imptcp.c.covscan	2021-01-18 11:21:14.000000000 +0100
000b35
+++ rsyslog-8.2102.0/plugins/imptcp/imptcp.c	2021-07-22 14:10:31.878231140 +0200
000b35
@@ -1920,6 +1920,7 @@ lstnActivity(ptcplstn_t *const pLstn)
000b35
 	}
000b35
 
000b35
 finalize_it:
000b35
+	// coverity[leaked_handle : FALSE]
000b35
 	RETiRet;
000b35
 }
000b35
 
000b35
diff -up rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c.covscan rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c
000b35
--- rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c.covscan	2020-10-03 19:06:47.000000000 +0200
000b35
+++ rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c	2021-07-22 14:10:31.879231138 +0200
000b35
@@ -394,7 +394,7 @@ CODEmodInit_QueryRegCFSLineHdlr
000b35
 		ABORT_FINALIZE(RS_RET_NO_MSG_PASSING);
000b35
 	}
000b35
 
000b35
-	
000b35
+	// coverity[identical_branches : FALSE]
000b35
 	CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
000b35
 				    resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
000b35
 ENDmodInit
000b35
diff -up rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c.covscan rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c
000b35
--- rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c.covscan	2020-10-03 19:06:47.000000000 +0200
000b35
+++ rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c	2021-07-22 14:10:31.879231138 +0200
000b35
@@ -368,6 +368,7 @@ writeDataError(wrkrInstanceData_t *const
000b35
 	}
000b35
 
000b35
 finalize_it:
000b35
+	// coverity[leaked_storage : FALSE]
000b35
 	RETiRet;
000b35
 }
000b35
 
000b35
diff -up rsyslog-8.2102.0/runtime/nsd_gtls.c.covscan rsyslog-8.2102.0/runtime/nsd_gtls.c
000b35
--- rsyslog-8.2102.0/runtime/nsd_gtls.c.covscan	2021-01-18 11:21:14.000000000 +0100
000b35
+++ rsyslog-8.2102.0/runtime/nsd_gtls.c	2021-07-22 14:17:06.183174167 +0200
000b35
@@ -227,7 +227,7 @@ gtlsLoadOurCertKey(nsd_gtls_t *pThis)
000b35
 	pThis->bOurKeyIsInit = 1;
000b35
 	CHKgnutls(gnutls_x509_privkey_import(pThis->ourKey, &data, GNUTLS_X509_FMT_PEM));
000b35
 	free(data.data);
000b35
-
000b35
+	data.data = NULL;
000b35
 
000b35
 finalize_it:
000b35
 	if(iRet == RS_RET_CERTLESS) {
000b35
diff -up rsyslog-8.2102.0/runtime/nsd_ptcp.c.covscan rsyslog-8.2102.0/runtime/nsd_ptcp.c
000b35
--- rsyslog-8.2102.0/runtime/nsd_ptcp.c.covscan	2021-02-15 08:20:04.000000000 +0100
000b35
+++ rsyslog-8.2102.0/runtime/nsd_ptcp.c	2021-07-22 14:10:31.879231138 +0200
000b35
@@ -191,6 +191,7 @@ SetTlsVerifyDepth(nsd_t __attribute__((u
000b35
 	nsd_ptcp_t *pThis = (nsd_ptcp_t*) pNsd;
000b35
 	DEFiRet;
000b35
 	ISOBJ_TYPE_assert((pThis), nsd_ptcp);
000b35
+	// coverity[identical_branches : FALSE]
000b35
 	if (verifyDepth == 0) {
000b35
 		FINALIZE;
000b35
 	}
000b35
diff -up rsyslog-8.2102.0/tools/rsyslogd.c.covscan rsyslog-8.2102.0/tools/rsyslogd.c
000b35
--- rsyslog-8.2102.0/tools/rsyslogd.c.covscan	2021-01-18 11:21:14.000000000 +0100
000b35
+++ rsyslog-8.2102.0/tools/rsyslogd.c	2021-07-22 14:10:31.879231138 +0200
000b35
@@ -293,6 +293,7 @@ writePidFile(void)
000b35
 		free((void*)tmpPidFile);
000b35
 	}
000b35
 finalize_it:
000b35
+	// coverity[leaked_storage : FALSE]
000b35
 	RETiRet;
000b35
 }
000b35
 
000b35
@@ -1026,6 +1027,7 @@ splitOversizeMessage(smsg_t *const pMsg)
000b35
 	/* if necessary, write partial last segment */
000b35
 	if(len_last_segment != 0) {
000b35
 		CHKmalloc(pMsg_seg = MsgDup(pMsg));
000b35
+		// coverity[copy_paste_error : FALSE]
000b35
 		MsgSetRawMsg(pMsg_seg, rawmsg + (nsegments * maxlen), len_last_segment);
000b35
 		submitMsg2(pMsg_seg);
000b35
 	}