Fixed Coverity tasks : 72722, 72706
This commit is contained in:
@ -541,6 +541,7 @@ static bool resolve_maxscale_homedir(
|
|||||||
{
|
{
|
||||||
bool succp;
|
bool succp;
|
||||||
char* tmp;
|
char* tmp;
|
||||||
|
char* tmp2;
|
||||||
char* log_context = NULL;
|
char* log_context = NULL;
|
||||||
|
|
||||||
ss_dassert(*p_home_dir == NULL);
|
ss_dassert(*p_home_dir == NULL);
|
||||||
@ -593,8 +594,9 @@ static bool resolve_maxscale_homedir(
|
|||||||
* isn't specified. Thus, try to access $PWD/MaxScale.cnf .
|
* isn't specified. Thus, try to access $PWD/MaxScale.cnf .
|
||||||
*/
|
*/
|
||||||
tmp = strndup(getenv("PWD"), PATH_MAX);
|
tmp = strndup(getenv("PWD"), PATH_MAX);
|
||||||
get_expanded_pathname(p_home_dir, tmp, default_cnf_fname);
|
tmp2 = get_expanded_pathname(p_home_dir, tmp, default_cnf_fname);
|
||||||
|
free(tmp2); /*< full path isn't needed so simply free it */
|
||||||
|
|
||||||
if (*p_home_dir != NULL)
|
if (*p_home_dir != NULL)
|
||||||
{
|
{
|
||||||
log_context = strdup("Current working directory");
|
log_context = strdup("Current working directory");
|
||||||
@ -646,7 +648,7 @@ check_home_dir:
|
|||||||
{
|
{
|
||||||
succp = false;
|
succp = false;
|
||||||
}
|
}
|
||||||
free (tmp);
|
free(tmp);
|
||||||
|
|
||||||
if (log_context != NULL)
|
if (log_context != NULL)
|
||||||
{
|
{
|
||||||
@ -880,6 +882,13 @@ static char* get_expanded_pathname(
|
|||||||
|
|
||||||
if (cnf_file_buf == NULL)
|
if (cnf_file_buf == NULL)
|
||||||
{
|
{
|
||||||
|
ss_dassert(cnf_file_buf != NULL);
|
||||||
|
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Memory allocation failed due to %s.",
|
||||||
|
strerror(errno))));
|
||||||
|
|
||||||
free(expanded_path);
|
free(expanded_path);
|
||||||
expanded_path = NULL;
|
expanded_path = NULL;
|
||||||
goto return_cnf_file_buf;
|
goto return_cnf_file_buf;
|
||||||
|
@ -1062,6 +1062,7 @@ int gw_MySQLListener(
|
|||||||
"\n* Failed to start listening MySQL due error %d, %s\n\n",
|
"\n* Failed to start listening MySQL due error %d, %s\n\n",
|
||||||
eno,
|
eno,
|
||||||
strerror(eno));
|
strerror(eno));
|
||||||
|
close(l_so);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// assign l_so to dcb
|
// assign l_so to dcb
|
||||||
@ -1191,8 +1192,8 @@ int gw_MySQLAccept(DCB *listener)
|
|||||||
strerror(eno))));
|
strerror(eno))));
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error %d, %s."
|
"Error : Failed to accept new client "
|
||||||
"Failed to accept new client connection.",
|
"connection due to %d, %s.",
|
||||||
eno,
|
eno,
|
||||||
strerror(eno))));
|
strerror(eno))));
|
||||||
rc = 1;
|
rc = 1;
|
||||||
@ -1223,9 +1224,9 @@ int gw_MySQLAccept(DCB *listener)
|
|||||||
if (client_dcb == NULL) {
|
if (client_dcb == NULL) {
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"%lu [gw_MySQLAccept] Failed to create "
|
"Error : Failed to create "
|
||||||
"dcb object for client connection.",
|
"DCB object for client connection.")));
|
||||||
pthread_self())));
|
close(c_sock);
|
||||||
rc = 1;
|
rc = 1;
|
||||||
goto return_rc;
|
goto return_rc;
|
||||||
}
|
}
|
||||||
@ -1327,6 +1328,7 @@ int gw_MySQLAccept(DCB *listener)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return_rc:
|
return_rc:
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user