Fixes to Coverity errors:
72747 75940 75941 73408 75425
This commit is contained in:
parent
4f39828fa1
commit
e1af60ac71
@ -39,7 +39,7 @@
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *enc;
|
||||
char *enc, *pw;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
@ -47,9 +47,21 @@ char *enc;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((enc = encryptPassword(argv[1])) != NULL)
|
||||
pw = calloc(81,sizeof(char));
|
||||
|
||||
if(pw == NULL){
|
||||
fprintf(stderr, "Error: cannot allocate enough memory.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
strncpy(pw,argv[1],80);
|
||||
|
||||
if ((enc = encryptPassword(pw)) != NULL){
|
||||
printf("%s\n", enc);
|
||||
else
|
||||
}else{
|
||||
fprintf(stderr, "Failed to encode the password\n");
|
||||
}
|
||||
|
||||
free(pw);
|
||||
return 0;
|
||||
}
|
||||
|
@ -61,7 +61,9 @@ int buflen;
|
||||
ss_info_dassert(0 == GWBUF_EMPTY(buffer), "Buffer should not be empty");
|
||||
ss_info_dassert(GWBUF_IS_TYPE_UNDEFINED(buffer), "Buffer type should be undefined");
|
||||
ss_dfprintf(stderr, "\t..done\nSet a hint for the buffer");
|
||||
hint = hint_create_parameter(NULL, strdup("name"), "value");
|
||||
char* name = strdup("name");
|
||||
hint = hint_create_parameter(NULL, name, "value");
|
||||
free(name);
|
||||
gwbuf_add_hint(buffer, hint);
|
||||
ss_info_dassert(hint == buffer->hint, "Buffer should point to first and only hint");
|
||||
ss_dfprintf(stderr, "\t..done\nSet a property for the buffer");
|
||||
|
@ -302,7 +302,7 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
|
||||
REGEX_INSTANCE *my_instance = (REGEX_INSTANCE *)instance;
|
||||
REGEX_SESSION *my_session = (REGEX_SESSION *)session;
|
||||
char *sql, *newsql;
|
||||
int length;
|
||||
int length = 0;
|
||||
|
||||
if (modutil_is_SQL(queue))
|
||||
{
|
||||
|
@ -415,6 +415,7 @@ GWBUF *clone = NULL;
|
||||
modutil_MySQL_Query(queue, &dummy, &length, &residual);
|
||||
clone = gwbuf_clone(queue);
|
||||
my_session->residual = residual;
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ int load_query()
|
||||
int i, qcount = 0, qbuff_sz = 10, rval = 0;
|
||||
int offset = 0;
|
||||
unsigned int qlen = 0;
|
||||
buffer = (char*)malloc(4092*sizeof(char));
|
||||
buffer = (char*)calloc(4092,sizeof(char));
|
||||
if(buffer == NULL){
|
||||
printf("Error: cannot allocate enough memory.\n");
|
||||
skygw_log_write(LOGFILE_ERROR,"Error: cannot allocate enough memory.\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user