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:
@ -253,6 +253,7 @@ static int logmanager_write_log(
|
|||||||
va_list valist);
|
va_list valist);
|
||||||
|
|
||||||
static blockbuf_t* blockbuf_init(logfile_id_t id);
|
static blockbuf_t* blockbuf_init(logfile_id_t id);
|
||||||
|
static void blockbuf_node_done(void* bb_data);
|
||||||
static char* blockbuf_get_writepos(
|
static char* blockbuf_get_writepos(
|
||||||
#if 0
|
#if 0
|
||||||
int** refcount,
|
int** refcount,
|
||||||
@ -996,8 +997,13 @@ static char* blockbuf_get_writepos(
|
|||||||
simple_mutex_unlock(&bb->bb_mutex);
|
simple_mutex_unlock(&bb->bb_mutex);
|
||||||
return pos;
|
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(
|
static blockbuf_t* blockbuf_init(
|
||||||
@ -2059,7 +2065,7 @@ static bool logfile_init(
|
|||||||
if (mlist_init(&logfile->lf_blockbuf_list,
|
if (mlist_init(&logfile->lf_blockbuf_list,
|
||||||
NULL,
|
NULL,
|
||||||
strdup("logfile block buffer list"),
|
strdup("logfile block buffer list"),
|
||||||
NULL,
|
blockbuf_node_done,
|
||||||
MAXNBLOCKBUFS) == NULL)
|
MAXNBLOCKBUFS) == NULL)
|
||||||
{
|
{
|
||||||
ss_dfprintf(stderr,
|
ss_dfprintf(stderr,
|
||||||
|
@ -706,6 +706,10 @@ static bool skygw_stmt_causes_implicit_commit(
|
|||||||
{
|
{
|
||||||
succp = true;
|
succp = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
succp =false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
succp = true;
|
succp = true;
|
||||||
|
@ -205,6 +205,18 @@ int error_count = 0;
|
|||||||
char *enable_root_user =
|
char *enable_root_user =
|
||||||
config_get_value(obj->parameters, "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 =
|
max_slave_conn_str =
|
||||||
config_get_value(obj->parameters,
|
config_get_value(obj->parameters,
|
||||||
"max_slave_connections");
|
"max_slave_connections");
|
||||||
|
@ -53,6 +53,17 @@ static void register_module(const char *module,
|
|||||||
void *modobj);
|
void *modobj);
|
||||||
static void unregister_module(const char *module);
|
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
|
* Load the dynamic library related to a gateway module. The routine
|
||||||
* will look for library files in the current directory,
|
* will look for library files in the current directory,
|
||||||
@ -82,10 +93,10 @@ MODULES *mod;
|
|||||||
sprintf(fname, "./lib%s.so", module);
|
sprintf(fname, "./lib%s.so", module);
|
||||||
if (access(fname, F_OK) == -1)
|
if (access(fname, F_OK) == -1)
|
||||||
{
|
{
|
||||||
if ((home = getenv("MAXSCALE_HOME")) == NULL)
|
home = get_maxscale_home ();
|
||||||
home = "/usr/local/skysql/MaxScale";
|
|
||||||
sprintf(fname, "%s/modules/lib%s.so", home, module);
|
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(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
@ -100,7 +111,7 @@ MODULES *mod;
|
|||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Unable to load library for module: "
|
"Error : Unable to load library for module: "
|
||||||
"%s, %s.",
|
"%s\n\t\t\t %s.",
|
||||||
module,
|
module,
|
||||||
dlerror())));
|
dlerror())));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -111,7 +122,7 @@ MODULES *mod;
|
|||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Version interface not supported by "
|
"Error : Version interface not supported by "
|
||||||
"module: %s, %s.",
|
"module: %s\n\t\t\t %s.",
|
||||||
module,
|
module,
|
||||||
dlerror())));
|
dlerror())));
|
||||||
dlclose(dlhandle);
|
dlclose(dlhandle);
|
||||||
@ -134,7 +145,7 @@ MODULES *mod;
|
|||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Expected entry point interface missing "
|
"Error : Expected entry point interface missing "
|
||||||
"from module: %s, %s.",
|
"from module: %s\n\t\t\t %s.",
|
||||||
module,
|
module,
|
||||||
dlerror())));
|
dlerror())));
|
||||||
dlclose(dlhandle);
|
dlclose(dlhandle);
|
||||||
|
@ -77,6 +77,20 @@ SERVICE *service;
|
|||||||
return NULL;
|
return NULL;
|
||||||
if ((service->router = load_module(router, MODULE_ROUTER)) == 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);
|
free(service);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -91,6 +105,7 @@ SERVICE *service;
|
|||||||
service->enable_root = 0;
|
service->enable_root = 0;
|
||||||
service->routerOptions = NULL;
|
service->routerOptions = NULL;
|
||||||
service->databases = NULL;
|
service->databases = NULL;
|
||||||
|
service->svc_config_param = NULL;
|
||||||
spinlock_init(&service->spin);
|
spinlock_init(&service->spin);
|
||||||
spinlock_init(&service->users_table_spin);
|
spinlock_init(&service->users_table_spin);
|
||||||
memset(&service->rate_limit, 0, sizeof(SERVICE_REFRESH_RATE));
|
memset(&service->rate_limit, 0, sizeof(SERVICE_REFRESH_RATE));
|
||||||
@ -835,10 +850,12 @@ static void service_add_qualified_param(
|
|||||||
SERVICE* svc,
|
SERVICE* svc,
|
||||||
CONFIG_PARAMETER* param)
|
CONFIG_PARAMETER* param)
|
||||||
{
|
{
|
||||||
CONFIG_PARAMETER** p = &svc->svc_config_param;
|
CONFIG_PARAMETER** p;
|
||||||
|
|
||||||
spinlock_acquire(&svc->spin);
|
spinlock_acquire(&svc->spin);
|
||||||
|
|
||||||
|
p = &svc->svc_config_param;
|
||||||
|
|
||||||
if ((*p) != NULL)
|
if ((*p) != NULL)
|
||||||
{
|
{
|
||||||
while ((*p)->next != NULL) *p = (*p)->next;
|
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 unload_module(const char *module);
|
||||||
extern void printModules();
|
extern void printModules();
|
||||||
extern void dprintAllModules(DCB *);
|
extern void dprintAllModules(DCB *);
|
||||||
|
char* get_maxscale_home(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -473,6 +473,7 @@ static void* newSession(
|
|||||||
|
|
||||||
/** Both Master and at least 1 slave must be found */
|
/** Both Master and at least 1 slave must be found */
|
||||||
if (!succp) {
|
if (!succp) {
|
||||||
|
free(client_rses->rses_backend_ref);
|
||||||
free(client_rses);
|
free(client_rses);
|
||||||
client_rses = NULL;
|
client_rses = NULL;
|
||||||
goto return_rses;
|
goto return_rses;
|
||||||
@ -613,6 +614,7 @@ static void freeSession(
|
|||||||
* all the memory and other resources associated
|
* all the memory and other resources associated
|
||||||
* to the client session.
|
* to the client session.
|
||||||
*/
|
*/
|
||||||
|
free(router_cli_ses->rses_backend_ref);
|
||||||
free(router_cli_ses);
|
free(router_cli_ses);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -793,6 +795,15 @@ static int routeQuery(
|
|||||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
||||||
"Packet type\t%s",
|
"Packet type\t%s",
|
||||||
STRPACKETTYPE(packet_type))));
|
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
|
* If autocommit is disabled or transaction is explicitly started
|
||||||
* transaction becomes active and master gets all statements until
|
* transaction becomes active and master gets all statements until
|
||||||
@ -1979,6 +1990,7 @@ static void tracelog_routed_query(
|
|||||||
b->backend_server->port,
|
b->backend_server->port,
|
||||||
STRBETYPE(be_type),
|
STRBETYPE(be_type),
|
||||||
dcb)));
|
dcb)));
|
||||||
|
free(querystr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gwbuf_free(buf);
|
gwbuf_free(buf);
|
||||||
|
Reference in New Issue
Block a user