Fixed minor format errors and resource leaks
Some format strings used integer values for unsigned integers. Memory and file descriptors leaked in some error conditions.
This commit is contained in:
parent
dcf0d4ef4b
commit
038877b8db
@ -1633,8 +1633,7 @@ int main(int argc, char **argv)
|
||||
MXS_ERROR("%s", errorbuffer);
|
||||
if (!daemon_mode)
|
||||
{
|
||||
strncat(errorbuffer, "\n", STRING_BUFFER_SIZE);
|
||||
fprintf(stderr, "%s", errorbuffer);
|
||||
fprintf(stderr, "%s\n", errorbuffer);
|
||||
}
|
||||
|
||||
rc = MAXSCALE_BADCONFIG;
|
||||
|
@ -1718,10 +1718,10 @@ RESULT_ROW *row;
|
||||
buf[39] = '\0';
|
||||
resultset_row_set(row, 0, buf);
|
||||
}
|
||||
snprintf(buf,39, "%d", queueStats.qtimes[*rowno]);
|
||||
snprintf(buf,39, "%u", queueStats.qtimes[*rowno]);
|
||||
buf[39] = '\0';
|
||||
resultset_row_set(row, 1, buf);
|
||||
snprintf(buf,39, "%d", queueStats.exectimes[*rowno]);
|
||||
snprintf(buf,39, "%u", queueStats.exectimes[*rowno]);
|
||||
buf[39] = '\0';
|
||||
resultset_row_set(row, 2, buf);
|
||||
(*rowno)++;
|
||||
|
@ -1242,6 +1242,7 @@ createInstance(char **options, FILTER_PARAMETER **params)
|
||||
if ((my_instance = calloc(1, sizeof(FW_INSTANCE))) == NULL ||
|
||||
(my_instance->lock = (SPINLOCK*) malloc(sizeof(SPINLOCK))) == NULL)
|
||||
{
|
||||
free(my_instance);
|
||||
MXS_ERROR("Memory allocation for firewall filter failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ int i,cflags = 0;
|
||||
else
|
||||
{
|
||||
MXS_ERROR("lagfilter: unsupported option '%s'.",
|
||||
options[i])));
|
||||
options[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1623,6 +1623,7 @@ char err_msg[STRERROR_BUFLEN];
|
||||
|
||||
if(chmod(tmp_file, S_IRUSR | S_IWUSR) < 0) {
|
||||
snprintf(error, BINLOG_ERROR_MSG_LEN, "%s, errno %u", strerror_r(errno, err_msg, sizeof(err_msg)), errno);
|
||||
fclose(config_file);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -3462,7 +3462,7 @@ static bool select_connect_backend_servers(
|
||||
MXS_WARNING("Couldn't connect to any of the %d "
|
||||
"slaves. Routing to %s only.",
|
||||
slaves_found,
|
||||
(is_synced_master ? "Galera nodes" : "Master"))));
|
||||
(is_synced_master ? "Galera nodes" : "Master"));
|
||||
#endif
|
||||
}
|
||||
else if (slaves_found == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user