Fixed Coverity tasks : 72722, 72706

This commit is contained in:
VilhoRaatikka 2014-10-31 15:55:13 +02:00
parent 7615e9c0ac
commit a342b453ac
2 changed files with 19 additions and 8 deletions

View File

@ -541,6 +541,7 @@ static bool resolve_maxscale_homedir(
{
bool succp;
char* tmp;
char* tmp2;
char* log_context = 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 .
*/
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)
{
log_context = strdup("Current working directory");
@ -646,7 +648,7 @@ check_home_dir:
{
succp = false;
}
free (tmp);
free(tmp);
if (log_context != NULL)
{
@ -880,6 +882,13 @@ static char* get_expanded_pathname(
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);
expanded_path = NULL;
goto return_cnf_file_buf;

View File

@ -1062,6 +1062,7 @@ int gw_MySQLListener(
"\n* Failed to start listening MySQL due error %d, %s\n\n",
eno,
strerror(eno));
close(l_so);
return 0;
}
// assign l_so to dcb
@ -1191,8 +1192,8 @@ int gw_MySQLAccept(DCB *listener)
strerror(eno))));
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error %d, %s."
"Failed to accept new client connection.",
"Error : Failed to accept new client "
"connection due to %d, %s.",
eno,
strerror(eno))));
rc = 1;
@ -1223,9 +1224,9 @@ int gw_MySQLAccept(DCB *listener)
if (client_dcb == NULL) {
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"%lu [gw_MySQLAccept] Failed to create "
"dcb object for client connection.",
pthread_self())));
"Error : Failed to create "
"DCB object for client connection.")));
close(c_sock);
rc = 1;
goto return_rc;
}
@ -1327,6 +1328,7 @@ int gw_MySQLAccept(DCB *listener)
}
#endif
return_rc:
return rc;
}