Fixes to Coverity errors 72653, 72685, 72707, 73391, 73393, 73394, 73410 and 73414.
This commit is contained in:
@ -550,7 +550,7 @@ HINT_TOKEN *tok;
|
|||||||
else if (!inword && inquote == '\0' && **ptr == '=')
|
else if (!inword && inquote == '\0' && **ptr == '=')
|
||||||
{
|
{
|
||||||
*dest = **ptr;
|
*dest = **ptr;
|
||||||
*dest++;
|
dest++;
|
||||||
(*ptr)++;
|
(*ptr)++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -748,9 +748,12 @@ int load_filter(FILTERCHAIN* fc, CONFIG* cnf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
for(x = 0;x<paramc;x++){
|
|
||||||
free(fparams[x]->name);
|
if(fparams){
|
||||||
free(fparams[x]->value);
|
for(x = 0;x<paramc;x++){
|
||||||
|
free(fparams[x]->name);
|
||||||
|
free(fparams[x]->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(fparams);
|
free(fparams);
|
||||||
@ -769,15 +772,18 @@ FILTERCHAIN* load_filter_module(char* str)
|
|||||||
flt_ptr->next = instance.head;
|
flt_ptr->next = instance.head;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((flt_ptr->instance = (FILTER_OBJECT*)load_module(str, MODULE_FILTER)) == NULL)
|
if(flt_ptr){
|
||||||
{
|
if( (flt_ptr->instance = (FILTER_OBJECT*)load_module(str, MODULE_FILTER)) == NULL)
|
||||||
printf("Error: Module loading failed: %s\n",str);
|
{
|
||||||
skygw_log_write(LOGFILE_ERROR,"Error: Module loading failed: %s\n",str);
|
printf("Error: Module loading failed: %s\n",str);
|
||||||
free(flt_ptr->down);
|
skygw_log_write(LOGFILE_ERROR,"Error: Module loading failed: %s\n",str);
|
||||||
free(flt_ptr);
|
free(flt_ptr->down);
|
||||||
return NULL;
|
free(flt_ptr);
|
||||||
}
|
return NULL;
|
||||||
flt_ptr->name = strdup(str);
|
}
|
||||||
|
flt_ptr->name = strdup(str);
|
||||||
|
}
|
||||||
|
|
||||||
return flt_ptr;
|
return flt_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,14 +931,35 @@ GWBUF* gen_packet(PACKET pkt)
|
|||||||
|
|
||||||
int process_opts(int argc, char** argv)
|
int process_opts(int argc, char** argv)
|
||||||
{
|
{
|
||||||
unsigned int fd = open_file("harness.cnf",1), buffsize = 1024;
|
int fd, buffsize = 1024;
|
||||||
int rd,rdsz;
|
int rd,rdsz, rval;
|
||||||
unsigned int fsize;
|
size_t fsize;
|
||||||
char *buff = calloc(buffsize,sizeof(char)), *tok = NULL;
|
char *buff = calloc(buffsize,sizeof(char)), *tok = NULL;
|
||||||
|
|
||||||
/**Parse 'harness.cnf' file*/
|
/**Parse 'harness.cnf' file*/
|
||||||
fsize = lseek(fd,0,SEEK_END);
|
|
||||||
lseek(fd,0,SEEK_SET);
|
if(buff == NULL){
|
||||||
|
printf("Error: Call to malloc() failed.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((fd = open_file("harness.cnf",1)) < 0){
|
||||||
|
printf("Failed to open configuration file.\n");
|
||||||
|
free(buff);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( (rval = lseek(fd,0,SEEK_END)) < 0 ||
|
||||||
|
lseek(fd,0,SEEK_SET) < 0){
|
||||||
|
printf("Error: Cannot seek file.\n");
|
||||||
|
close(fd);
|
||||||
|
free(buff);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fsize = (size_t)rval;
|
||||||
|
|
||||||
instance.thrcount = 1;
|
instance.thrcount = 1;
|
||||||
instance.session_count = 1;
|
instance.session_count = 1;
|
||||||
rdsz = read(fd,buff,fsize);
|
rdsz = read(fd,buff,fsize);
|
||||||
|
@ -768,9 +768,43 @@ int gw_do_connect_to_backend(
|
|||||||
setipaddress(&serv_addr.sin_addr, host);
|
setipaddress(&serv_addr.sin_addr, host);
|
||||||
serv_addr.sin_port = htons(port);
|
serv_addr.sin_port = htons(port);
|
||||||
bufsize = GW_BACKEND_SO_SNDBUF;
|
bufsize = GW_BACKEND_SO_SNDBUF;
|
||||||
setsockopt(so, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize));
|
|
||||||
|
if(setsockopt(so, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize)) != 0)
|
||||||
|
{
|
||||||
|
int eno = errno;
|
||||||
|
errno = 0;
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error: Failed to set socket options "
|
||||||
|
"%s:%d failed.\n\t\t Socket configuration failed "
|
||||||
|
"due %d, %s.",
|
||||||
|
host,
|
||||||
|
port,
|
||||||
|
eno,
|
||||||
|
strerror(eno))));
|
||||||
|
rv = -1;
|
||||||
|
goto return_rv;
|
||||||
|
}
|
||||||
|
|
||||||
bufsize = GW_BACKEND_SO_RCVBUF;
|
bufsize = GW_BACKEND_SO_RCVBUF;
|
||||||
setsockopt(so, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize));
|
|
||||||
|
if(setsockopt(so, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize)) != 0)
|
||||||
|
{
|
||||||
|
int eno = errno;
|
||||||
|
errno = 0;
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error: Failed to set socket options "
|
||||||
|
"%s:%d failed.\n\t\t Socket configuration failed "
|
||||||
|
"due %d, %s.",
|
||||||
|
host,
|
||||||
|
port,
|
||||||
|
eno,
|
||||||
|
strerror(eno))));
|
||||||
|
rv = -1;
|
||||||
|
goto return_rv;
|
||||||
|
}
|
||||||
|
|
||||||
/* set socket to as non-blocking here */
|
/* set socket to as non-blocking here */
|
||||||
setnonblocking(so);
|
setnonblocking(so);
|
||||||
rv = connect(so, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
|
rv = connect(so, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
|
||||||
|
@ -830,8 +830,16 @@ static void* newSession(
|
|||||||
* Find a backend servers to connect to.
|
* Find a backend servers to connect to.
|
||||||
* This command requires that rsession's lock is held.
|
* This command requires that rsession's lock is held.
|
||||||
*/
|
*/
|
||||||
rses_begin_locked_router_action(client_rses);
|
|
||||||
|
|
||||||
|
succp = rses_begin_locked_router_action(client_rses);
|
||||||
|
|
||||||
|
if(!succp){
|
||||||
|
free(client_rses->rses_backend_ref);
|
||||||
|
free(client_rses);
|
||||||
|
client_rses = NULL;
|
||||||
|
goto return_rses;
|
||||||
|
}
|
||||||
|
|
||||||
succp = select_connect_backend_servers(&master_ref,
|
succp = select_connect_backend_servers(&master_ref,
|
||||||
backend_ref,
|
backend_ref,
|
||||||
router_nservers,
|
router_nservers,
|
||||||
@ -1610,8 +1618,12 @@ void check_create_tmp_table(
|
|||||||
rses_prop_tmp->rses_prop_type = RSES_PROP_TYPE_TMPTABLES;
|
rses_prop_tmp->rses_prop_type = RSES_PROP_TYPE_TMPTABLES;
|
||||||
router_cli_ses->rses_properties[RSES_PROP_TYPE_TMPTABLES] = rses_prop_tmp;
|
router_cli_ses->rses_properties[RSES_PROP_TYPE_TMPTABLES] = rses_prop_tmp;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error : Call to malloc() failed.")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if(rses_prop_tmp){
|
||||||
if (rses_prop_tmp->rses_prop_data.temp_tables == NULL)
|
if (rses_prop_tmp->rses_prop_data.temp_tables == NULL)
|
||||||
{
|
{
|
||||||
h = hashtable_alloc(7, hashkeyfun, hashcmpfun);
|
h = hashtable_alloc(7, hashkeyfun, hashcmpfun);
|
||||||
@ -1647,6 +1659,8 @@ void check_create_tmp_table(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
free(hkey);
|
free(hkey);
|
||||||
free(tblname);
|
free(tblname);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user