[modify for coverity scan]

This commit is contained in:
Hui Li 2020-06-17 17:03:13 +08:00
parent 1debfc0d8e
commit 603e31a588
7 changed files with 8 additions and 7 deletions

View File

@ -433,7 +433,6 @@ void taosCacheEmpty(SCacheObj *pCacheObj) {
__cache_wr_lock(pCacheObj);
while (taosHashIterNext(pIter)) {
if (pCacheObj->deleting == 1) {
taosHashDestroyIter(pIter);
break;
}

View File

@ -551,7 +551,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char
delta_of_delta = 0;
} else {
if (is_bigendian()) {
memcpy(&dd1 + LONG_BYTES - nbytes, input + ipos, nbytes);
memcpy(((char *)(&dd1)) + LONG_BYTES - nbytes, input + ipos, nbytes);
} else {
memcpy(&dd1, input + ipos, nbytes);
}
@ -576,7 +576,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char
delta_of_delta = 0;
} else {
if (is_bigendian()) {
memcpy(&dd2 + LONG_BYTES - nbytes, input + ipos, nbytes);
memcpy(((char *)(&dd2)) + LONG_BYTES - nbytes, input + ipos, nbytes);
} else {
memcpy(&dd2, input + ipos, nbytes);
}

View File

@ -537,5 +537,6 @@ static int tdRestoreKVStore(SKVStore *pStore) {
_err:
tfree(buf);
taosHashDestroyIter(pIter);
return -1;
}

View File

@ -226,7 +226,7 @@ int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInf
void taosNotePrint(taosNoteInfo * pNote, const char * const format, ...)
{
va_list argpointer;
char buffer[MAX_NOTE_LINE_SIZE];
char buffer[MAX_NOTE_LINE_SIZE+2];
int len;
struct tm Tm, *ptm;
struct timeval timeSecs;

View File

@ -278,7 +278,7 @@ int taosOpenUdpSocket(uint32_t ip, uint16_t port) {
/* bind socket to local address */
if (bind(sockFd, (struct sockaddr *)&localAddr, sizeof(localAddr)) < 0) {
uError("failed to bind udp socket: %d (%s), 0x%x:%hu", errno, strerror(errno), ip, port);
taosCloseSocket(sockFd);
close(sockFd);
return -1;
}
@ -321,7 +321,7 @@ int taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clientI
if (ret != 0) {
//uError("failed to connect socket, ip:0x%x, port:%hu(%s)", destIp, destPort, strerror(errno));
taosCloseSocket(sockFd);
close(sockFd);
sockFd = -1;
}

View File

@ -290,6 +290,7 @@ static void addToExpired(tmr_obj_t* head) {
SSchedMsg schedMsg;
schedMsg.fp = NULL;
schedMsg.tfp = processExpiredTimer;
schedMsg.msg = NULL;
schedMsg.ahandle = head;
schedMsg.thandle = NULL;
taosScheduleTask(tmrQhandle, &schedMsg);

View File

@ -557,7 +557,7 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) {
return false;
}
int versionNumberPos[4] = {0};
int versionNumberPos[5] = {0};
int len = strlen(versionStr);
int dot = 0;
for (int pos = 0; pos < len && dot < 4; ++pos) {