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:
@ -1633,8 +1633,7 @@ int main(int argc, char **argv)
|
|||||||
MXS_ERROR("%s", errorbuffer);
|
MXS_ERROR("%s", errorbuffer);
|
||||||
if (!daemon_mode)
|
if (!daemon_mode)
|
||||||
{
|
{
|
||||||
strncat(errorbuffer, "\n", STRING_BUFFER_SIZE);
|
fprintf(stderr, "%s\n", errorbuffer);
|
||||||
fprintf(stderr, "%s", errorbuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = MAXSCALE_BADCONFIG;
|
rc = MAXSCALE_BADCONFIG;
|
||||||
|
@ -1718,10 +1718,10 @@ RESULT_ROW *row;
|
|||||||
buf[39] = '\0';
|
buf[39] = '\0';
|
||||||
resultset_row_set(row, 0, buf);
|
resultset_row_set(row, 0, buf);
|
||||||
}
|
}
|
||||||
snprintf(buf,39, "%d", queueStats.qtimes[*rowno]);
|
snprintf(buf,39, "%u", queueStats.qtimes[*rowno]);
|
||||||
buf[39] = '\0';
|
buf[39] = '\0';
|
||||||
resultset_row_set(row, 1, buf);
|
resultset_row_set(row, 1, buf);
|
||||||
snprintf(buf,39, "%d", queueStats.exectimes[*rowno]);
|
snprintf(buf,39, "%u", queueStats.exectimes[*rowno]);
|
||||||
buf[39] = '\0';
|
buf[39] = '\0';
|
||||||
resultset_row_set(row, 2, buf);
|
resultset_row_set(row, 2, buf);
|
||||||
(*rowno)++;
|
(*rowno)++;
|
||||||
|
@ -1242,6 +1242,7 @@ createInstance(char **options, FILTER_PARAMETER **params)
|
|||||||
if ((my_instance = calloc(1, sizeof(FW_INSTANCE))) == NULL ||
|
if ((my_instance = calloc(1, sizeof(FW_INSTANCE))) == NULL ||
|
||||||
(my_instance->lock = (SPINLOCK*) malloc(sizeof(SPINLOCK))) == NULL)
|
(my_instance->lock = (SPINLOCK*) malloc(sizeof(SPINLOCK))) == NULL)
|
||||||
{
|
{
|
||||||
|
free(my_instance);
|
||||||
MXS_ERROR("Memory allocation for firewall filter failed.");
|
MXS_ERROR("Memory allocation for firewall filter failed.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ int i,cflags = 0;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MXS_ERROR("lagfilter: unsupported option '%s'.",
|
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) {
|
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);
|
snprintf(error, BINLOG_ERROR_MSG_LEN, "%s, errno %u", strerror_r(errno, err_msg, sizeof(err_msg)), errno);
|
||||||
|
fclose(config_file);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3462,7 +3462,7 @@ static bool select_connect_backend_servers(
|
|||||||
MXS_WARNING("Couldn't connect to any of the %d "
|
MXS_WARNING("Couldn't connect to any of the %d "
|
||||||
"slaves. Routing to %s only.",
|
"slaves. Routing to %s only.",
|
||||||
slaves_found,
|
slaves_found,
|
||||||
(is_synced_master ? "Galera nodes" : "Master"))));
|
(is_synced_master ? "Galera nodes" : "Master"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (slaves_found == 0)
|
else if (slaves_found == 0)
|
||||||
|
Reference in New Issue
Block a user