Fix to Coverity cases 73417, 73420, 72759, 72639

This commit is contained in:
VilhoRaatikka
2014-10-31 23:11:19 +02:00
parent 3f375e680a
commit deffd4a69f
3 changed files with 5 additions and 3 deletions

View File

@ -81,6 +81,7 @@ SHARED_BUF *sbuf;
if ((sbuf = (SHARED_BUF *)malloc(sizeof(SHARED_BUF))) == NULL) if ((sbuf = (SHARED_BUF *)malloc(sizeof(SHARED_BUF))) == NULL)
{ {
free(rval); free(rval);
rval = NULL;
goto retblock; goto retblock;
} }
@ -90,6 +91,7 @@ SHARED_BUF *sbuf;
ss_dassert(sbuf->data != NULL); ss_dassert(sbuf->data != NULL);
free(rval); free(rval);
free(sbuf); free(sbuf);
rval = NULL;
goto retblock; goto retblock;
} }
spinlock_init(&rval->gwbuf_lock); spinlock_init(&rval->gwbuf_lock);
@ -106,9 +108,8 @@ SHARED_BUF *sbuf;
rval->gwbuf_bufobj = NULL; rval->gwbuf_bufobj = NULL;
CHK_GWBUF(rval); CHK_GWBUF(rval);
retblock: retblock:
if (rval == NULL || sbuf == NULL || sbuf->data == NULL) if (rval == NULL)
{ {
ss_dassert(rval != NULL && sbuf != NULL && sbuf->data != NULL);
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
"Error : Memory allocation failed due to %s.", "Error : Memory allocation failed due to %s.",

View File

@ -254,6 +254,7 @@ MAXKEYS key;
secret_file, secret_file,
errno, errno,
strerror(errno)))); strerror(errno))));
close(fd);
return 1; return 1;
} }

View File

@ -430,7 +430,7 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) {
connect_with_db = connect_with_db =
GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB & gw_mysql_get_byte4( GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB & gw_mysql_get_byte4(
&protocol->client_capabilities); (uint32_t *)&protocol->client_capabilities);
/* /*
compress = compress =
GW_MYSQL_CAPABILITIES_COMPRESS & gw_mysql_get_byte4( GW_MYSQL_CAPABILITIES_COMPRESS & gw_mysql_get_byte4(