log_manager.cc fixed memory leak, block buffer mutex names weren't freed.
query_classifier.cc use of uninitialized value in skygw_stmt_causes_implicit_commit config.c crashed if module load failed, use of unitialized value load_utils.c pretty-printed error service.c use of uninitialized value in service_add_qualified_param modules.h function prototype readwritesplit.c memory leaks
This commit is contained in:
parent
8a40a44823
commit
b5e9428ff7
@ -253,6 +253,7 @@ static int logmanager_write_log(
|
||||
va_list valist);
|
||||
|
||||
static blockbuf_t* blockbuf_init(logfile_id_t id);
|
||||
static void blockbuf_node_done(void* bb_data);
|
||||
static char* blockbuf_get_writepos(
|
||||
#if 0
|
||||
int** refcount,
|
||||
@ -996,8 +997,13 @@ static char* blockbuf_get_writepos(
|
||||
simple_mutex_unlock(&bb->bb_mutex);
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
static void blockbuf_node_done(
|
||||
void* bb_data)
|
||||
{
|
||||
blockbuf_t* bb = (blockbuf_t *)bb_data;
|
||||
simple_mutex_done(&bb->bb_mutex);
|
||||
}
|
||||
|
||||
|
||||
static blockbuf_t* blockbuf_init(
|
||||
@ -2059,7 +2065,7 @@ static bool logfile_init(
|
||||
if (mlist_init(&logfile->lf_blockbuf_list,
|
||||
NULL,
|
||||
strdup("logfile block buffer list"),
|
||||
NULL,
|
||||
blockbuf_node_done,
|
||||
MAXNBLOCKBUFS) == NULL)
|
||||
{
|
||||
ss_dfprintf(stderr,
|
||||
|
@ -706,6 +706,10 @@ static bool skygw_stmt_causes_implicit_commit(
|
||||
{
|
||||
succp = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
succp =false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
succp = true;
|
||||
|
@ -205,6 +205,18 @@ int error_count = 0;
|
||||
char *enable_root_user =
|
||||
config_get_value(obj->parameters, "enable_root_user");
|
||||
|
||||
if (obj->element == NULL)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Reading configuration "
|
||||
"for router service '%s' failed. "
|
||||
"Router %s is not loaded.",
|
||||
obj->object,
|
||||
obj->object)));
|
||||
obj = obj->next;
|
||||
continue; /*< process next obj */
|
||||
}
|
||||
max_slave_conn_str =
|
||||
config_get_value(obj->parameters,
|
||||
"max_slave_connections");
|
||||
|
@ -53,6 +53,17 @@ static void register_module(const char *module,
|
||||
void *modobj);
|
||||
static void unregister_module(const char *module);
|
||||
|
||||
char* get_maxscale_home(void)
|
||||
{
|
||||
char* home = getenv("MAXSCALE_HOME");
|
||||
if (home == NULL)
|
||||
{
|
||||
home = "/usr/local/skysql/MaxScale";
|
||||
}
|
||||
return home;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the dynamic library related to a gateway module. The routine
|
||||
* will look for library files in the current directory,
|
||||
@ -82,10 +93,10 @@ MODULES *mod;
|
||||
sprintf(fname, "./lib%s.so", module);
|
||||
if (access(fname, F_OK) == -1)
|
||||
{
|
||||
if ((home = getenv("MAXSCALE_HOME")) == NULL)
|
||||
home = "/usr/local/skysql/MaxScale";
|
||||
home = get_maxscale_home ();
|
||||
sprintf(fname, "%s/modules/lib%s.so", home, module);
|
||||
if (access(fname, F_OK) == -1)
|
||||
|
||||
if (access(fname, F_OK) == -1)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
@ -100,7 +111,7 @@ MODULES *mod;
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Unable to load library for module: "
|
||||
"%s, %s.",
|
||||
"%s\n\t\t\t %s.",
|
||||
module,
|
||||
dlerror())));
|
||||
return NULL;
|
||||
@ -111,7 +122,7 @@ MODULES *mod;
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Version interface not supported by "
|
||||
"module: %s, %s.",
|
||||
"module: %s\n\t\t\t %s.",
|
||||
module,
|
||||
dlerror())));
|
||||
dlclose(dlhandle);
|
||||
@ -134,7 +145,7 @@ MODULES *mod;
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Expected entry point interface missing "
|
||||
"from module: %s, %s.",
|
||||
"from module: %s\n\t\t\t %s.",
|
||||
module,
|
||||
dlerror())));
|
||||
dlclose(dlhandle);
|
||||
|
@ -77,6 +77,20 @@ SERVICE *service;
|
||||
return NULL;
|
||||
if ((service->router = load_module(router, MODULE_ROUTER)) == NULL)
|
||||
{
|
||||
char* home = get_maxscale_home();
|
||||
char* ldpath = getenv("LD_LIBRARY_PATH");
|
||||
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Unable to load %s module \"%s\".\n\t\t\t"
|
||||
" Ensure that lib%s.so exists in one of the "
|
||||
"following directories :\n\t\t\t "
|
||||
"- %s/modules\n\t\t\t - %s",
|
||||
MODULE_ROUTER,
|
||||
router,
|
||||
router,
|
||||
home,
|
||||
ldpath)));
|
||||
free(service);
|
||||
return NULL;
|
||||
}
|
||||
@ -91,6 +105,7 @@ SERVICE *service;
|
||||
service->enable_root = 0;
|
||||
service->routerOptions = NULL;
|
||||
service->databases = NULL;
|
||||
service->svc_config_param = NULL;
|
||||
spinlock_init(&service->spin);
|
||||
spinlock_init(&service->users_table_spin);
|
||||
memset(&service->rate_limit, 0, sizeof(SERVICE_REFRESH_RATE));
|
||||
@ -835,10 +850,12 @@ static void service_add_qualified_param(
|
||||
SERVICE* svc,
|
||||
CONFIG_PARAMETER* param)
|
||||
{
|
||||
CONFIG_PARAMETER** p = &svc->svc_config_param;
|
||||
CONFIG_PARAMETER** p;
|
||||
|
||||
spinlock_acquire(&svc->spin);
|
||||
|
||||
p = &svc->svc_config_param;
|
||||
|
||||
if ((*p) != NULL)
|
||||
{
|
||||
while ((*p)->next != NULL) *p = (*p)->next;
|
||||
|
@ -55,4 +55,6 @@ extern void *load_module(const char *module, const char *type);
|
||||
extern void unload_module(const char *module);
|
||||
extern void printModules();
|
||||
extern void dprintAllModules(DCB *);
|
||||
char* get_maxscale_home(void);
|
||||
|
||||
#endif
|
||||
|
@ -473,6 +473,7 @@ static void* newSession(
|
||||
|
||||
/** Both Master and at least 1 slave must be found */
|
||||
if (!succp) {
|
||||
free(client_rses->rses_backend_ref);
|
||||
free(client_rses);
|
||||
client_rses = NULL;
|
||||
goto return_rses;
|
||||
@ -613,6 +614,7 @@ static void freeSession(
|
||||
* all the memory and other resources associated
|
||||
* to the client session.
|
||||
*/
|
||||
free(router_cli_ses->rses_backend_ref);
|
||||
free(router_cli_ses);
|
||||
return;
|
||||
}
|
||||
@ -793,6 +795,15 @@ static int routeQuery(
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
||||
"Packet type\t%s",
|
||||
STRPACKETTYPE(packet_type))));
|
||||
#if defined(AUTOCOMMIT_OPT)
|
||||
if ((QUERY_IS_TYPE(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT) &&
|
||||
!router_cli_ses->rses_autocommit_enabled) ||
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) &&
|
||||
router_cli_ses->rses_autocommit_enabled))
|
||||
{
|
||||
/** reply directly to client */
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* If autocommit is disabled or transaction is explicitly started
|
||||
* transaction becomes active and master gets all statements until
|
||||
@ -1979,6 +1990,7 @@ static void tracelog_routed_query(
|
||||
b->backend_server->port,
|
||||
STRBETYPE(be_type),
|
||||
dcb)));
|
||||
free(querystr);
|
||||
}
|
||||
}
|
||||
gwbuf_free(buf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user