diff --git a/server/core/maxpasswd.c b/server/core/maxpasswd.c index 8d90a7631..0c728d869 100644 --- a/server/core/maxpasswd.c +++ b/server/core/maxpasswd.c @@ -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; } diff --git a/server/core/test/testbuffer.c b/server/core/test/testbuffer.c index ee8507161..73d71dc27 100644 --- a/server/core/test/testbuffer.c +++ b/server/core/test/testbuffer.c @@ -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"); diff --git a/server/modules/filter/regexfilter.c b/server/modules/filter/regexfilter.c index b76442079..53a775f83 100644 --- a/server/modules/filter/regexfilter.c +++ b/server/modules/filter/regexfilter.c @@ -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)) { diff --git a/server/modules/filter/tee.c b/server/modules/filter/tee.c index 3b35d7b8e..94dc29ea0 100644 --- a/server/modules/filter/tee.c +++ b/server/modules/filter/tee.c @@ -415,6 +415,7 @@ GWBUF *clone = NULL; modutil_MySQL_Query(queue, &dummy, &length, &residual); clone = gwbuf_clone(queue); my_session->residual = residual; + free(ptr); } } diff --git a/server/modules/filter/test/harness_common.c b/server/modules/filter/test/harness_common.c index 29ed2cf53..a345a5e09 100644 --- a/server/modules/filter/test/harness_common.c +++ b/server/modules/filter/test/harness_common.c @@ -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");