Fix to Coverity error 75425

This commit is contained in:
Markus Makela
2014-11-06 16:23:38 +02:00
parent c4d51f54cd
commit 831ad11a30

View File

@ -303,18 +303,19 @@ int load_query()
int i, qcount = 0, qbuff_sz = 10, rval = 0;
int offset = 0;
unsigned int qlen = 0;
if((buffer = malloc(4092*sizeof(char))) == NULL){
buffer = (char*)malloc(4092*sizeof(char));
if(buffer == NULL){
printf("Error: cannot allocate enough memory.\n");
skygw_log_write(LOGFILE_ERROR,"Error: cannot allocate enough memory.\n");
return 1;
}
if((query_list = calloc(qbuff_sz,sizeof(char*))) == NULL){
query_list = calloc(qbuff_sz,sizeof(char*));
if(query_list == NULL){
printf("Error: cannot allocate enough memory.\n");
skygw_log_write(LOGFILE_ERROR,"Error: cannot allocate enough memory.\n");
rval = 1;
goto retblock;
free(buffer);
return 1;
}