Fix to bug #610, http://bugs.mariadb.com/show_bug.cgi?id=610
Fixes to Coverity issues 72728, 72755, 72745
This commit is contained in:
@ -855,9 +855,6 @@ static int uh_cmpfun( void* v1, void* v2) {
|
|||||||
if (v1 == NULL || v2 == NULL)
|
if (v1 == NULL || v2 == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (hu1 == NULL || hu2 == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (hu1->user == NULL || hu2->user == NULL)
|
if (hu1->user == NULL || hu2->user == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -961,9 +958,6 @@ char *mysql_format_user_entry(void *data)
|
|||||||
|
|
||||||
entry = (MYSQL_USER_HOST *) data;
|
entry = (MYSQL_USER_HOST *) data;
|
||||||
|
|
||||||
if (entry == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
mysql_user = (char *) calloc(mysql_user_len, sizeof(char));
|
mysql_user = (char *) calloc(mysql_user_len, sizeof(char));
|
||||||
|
|
||||||
if (mysql_user == NULL)
|
if (mysql_user == NULL)
|
||||||
|
@ -1155,10 +1155,9 @@ dcb_close(DCB *dcb)
|
|||||||
} else {
|
} else {
|
||||||
LOGIF(LE, (skygw_log_write(
|
LOGIF(LE, (skygw_log_write(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"%lu [dcb_close] Error : Removing dcb %p in state %s from "
|
"Error : Removing DCB fd == %d in state %s from "
|
||||||
"poll set failed.",
|
"poll set failed.",
|
||||||
pthread_self(),
|
dcb->fd,
|
||||||
dcb,
|
|
||||||
STRDCBSTATE(dcb->state))));
|
STRDCBSTATE(dcb->state))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1670,7 +1669,7 @@ static bool dcb_set_state_nomutex(
|
|||||||
"Old state %s > new state %s.",
|
"Old state %s > new state %s.",
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
dcb,
|
dcb,
|
||||||
STRDCBSTATE(*old_state),
|
(old_state == NULL ? "NULL" : STRDCBSTATE(*old_state)),
|
||||||
STRDCBSTATE(new_state))));
|
STRDCBSTATE(new_state))));
|
||||||
}
|
}
|
||||||
return succp;
|
return succp;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <filter.h>
|
#include <filter.h>
|
||||||
#include <modinfo.h>
|
#include <modinfo.h>
|
||||||
#include <modutil.h>
|
#include <modutil.h>
|
||||||
@ -265,10 +266,17 @@ char *remote, *userName;
|
|||||||
(char *)malloc(strlen(my_instance->filebase) + 20))
|
(char *)malloc(strlen(my_instance->filebase) + 20))
|
||||||
== NULL)
|
== NULL)
|
||||||
{
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Memory allocation for qla filter "
|
||||||
|
"file name failed due to %d, %s.",
|
||||||
|
errno,
|
||||||
|
strerror(errno))));
|
||||||
free(my_session);
|
free(my_session);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
my_session->active = 1;
|
my_session->active = 1;
|
||||||
|
|
||||||
if (my_instance->source
|
if (my_instance->source
|
||||||
&& (remote = session_get_remote(session)) != NULL)
|
&& (remote = session_get_remote(session)) != NULL)
|
||||||
{
|
{
|
||||||
@ -276,16 +284,45 @@ char *remote, *userName;
|
|||||||
my_session->active = 0;
|
my_session->active = 0;
|
||||||
}
|
}
|
||||||
userName = session_getUser(session);
|
userName = session_getUser(session);
|
||||||
if (my_instance->userName && userName && strcmp(userName,
|
|
||||||
my_instance->userName))
|
if (my_instance->userName &&
|
||||||
|
userName &&
|
||||||
|
strcmp(userName,my_instance->userName))
|
||||||
|
{
|
||||||
my_session->active = 0;
|
my_session->active = 0;
|
||||||
sprintf(my_session->filename, "%s.%d", my_instance->filebase,
|
}
|
||||||
|
sprintf(my_session->filename, "%s.%d",
|
||||||
|
my_instance->filebase,
|
||||||
my_instance->sessions);
|
my_instance->sessions);
|
||||||
my_instance->sessions++;
|
my_instance->sessions++;
|
||||||
if (my_session->active)
|
|
||||||
my_session->fp = fopen(my_session->filename, "w");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (my_session->active)
|
||||||
|
{
|
||||||
|
my_session->fp = fopen(my_session->filename, "w");
|
||||||
|
|
||||||
|
if (my_session->fp == NULL)
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Opening output file for qla "
|
||||||
|
"fileter failed due to %d, %s",
|
||||||
|
errno,
|
||||||
|
strerror(errno))));
|
||||||
|
free(my_session->filename);
|
||||||
|
free(my_session);
|
||||||
|
my_session = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Memory allocation for qla filter failed due to "
|
||||||
|
"%d, %s.",
|
||||||
|
errno,
|
||||||
|
strerror(errno))));
|
||||||
|
}
|
||||||
return my_session;
|
return my_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user