Fixes to Coverity bugs:

72743
73407
73408
73409
73415
73419
This commit is contained in:
Markus Makela
2014-11-06 15:40:11 +02:00
parent 8925f79286
commit c4d51f54cd
7 changed files with 29 additions and 21 deletions

View File

@ -269,7 +269,7 @@ int result = 0;
char *home, buf[1024];
/* Unlink any existing password file before running this test */
if ((home = getenv("MAXSCALE_HOME")) == NULL)
if ((home = getenv("MAXSCALE_HOME")) == NULL || strlen(home) >= 1024)
home = "/usr/local/skysql";
sprintf(buf, "%s/etc/passwd", home);
if (strcmp(buf, "/etc/passwd") != 0)

View File

@ -158,6 +158,7 @@ static bool do_hashtest(
hashtable_free(h);
return_succp:
free(val_arr);
return succp;
}

View File

@ -46,7 +46,9 @@ HINT *hint;
/* Hint tests */
ss_dfprintf(stderr,
"testhint : Add a parameter hint to a null list");
hint = hint_create_parameter(NULL, strdup("name"), "value");
char* name = strdup("name");
hint = hint_create_parameter(NULL, name, "value");
free(name);
ss_info_dassert(NULL != hint, "New hint list should not be null");
ss_info_dassert(0 == strcmp("value", hint->value), "Hint value should be correct");
ss_info_dassert(0 != hint_exists(&hint, HINT_PARAMETER), "Hint of parameter type should exist");

View File

@ -68,7 +68,8 @@ char *status;
server_set_status(server, SERVER_MASTER);
status = server_status(server);
ss_info_dassert(0 == strcmp("Master, Running", status), "Should find correct status.");
server_clear_status(server, SERVER_MASTER);
server_clear_status(server, SERVER_MASTER);
free(status);
status = server_status(server);
ss_info_dassert(0 == strcmp("Running", status), "Status of Server should be Running after master status cleared.");
if (NULL != status) free(status);
@ -78,7 +79,6 @@ char *status;
ss_dfprintf(stderr, "\t..done\nFreeing Server.");
ss_info_dassert(0 != server_free(server), "Free should succeed");
ss_dfprintf(stderr, "\t..done\n");
return 0;
}