Bug #468, http://bugs.skysql.com/show_bug.cgi?id=468, Query classifier accessed freed thread context. If parsing fails thd doesn't need to be freed because it holds correct information about command type.
session.c:session_setup_filters : fixed memory leak hintparser.c: added token_free for HINT_TOKENs and fixed a few memory leaks. mysql_client_server_protocol.h: added mysql_protocol_done which frees memory blocks pointed to by protocol members. Those can't be freed in dcb.c because dcb.c doesn't know about protocol's members. mysql_backend.c:gw_backend_close: fixed memory leak mysql_client.c: gw_client_close: fixed memory leak mysql_common.c: added implementation of mysql_protocol_done :protocol_archive_srv_command: tried to fix memory leak. Some memory is still leaking according to valgrind. Removed use of uninitialized local variable len. readwritesplit.c: Fix to bug #469, http://bugs.skysql.com/show_bug.cgi?id=469, rwsplit counts every connection twice in master - counnection counts leak execute_sescmd_in_backend: fixed a memory leak - visible only in DEBUG=Y build. readwritesplit/test/makefile: added target for hints tests
This commit is contained in:
@ -77,9 +77,20 @@ static HINT *lookup_named_hint(HINT_SESSION *, char *);
|
||||
static void create_named_hint(HINT_SESSION *, char *, HINT *);
|
||||
static void hint_push(HINT_SESSION *, HINT *);
|
||||
static const char* token_get_keyword (TOKEN_VALUE token);
|
||||
static void token_free(HINT_TOKEN* token);
|
||||
|
||||
typedef enum { HM_EXECUTE, HM_START, HM_PREPARE } HINT_MODE;
|
||||
|
||||
void token_free(HINT_TOKEN* token)
|
||||
{
|
||||
if (token->value != NULL)
|
||||
{
|
||||
free(token->value);
|
||||
}
|
||||
free(token);
|
||||
}
|
||||
|
||||
|
||||
static const char* token_get_keyword (
|
||||
TOKEN_VALUE token)
|
||||
{
|
||||
@ -224,11 +235,13 @@ HINT_MODE mode = HM_EXECUTE;
|
||||
"with keyword '%s'",
|
||||
token_get_keyword(tok->token),
|
||||
token_get_keyword(TOK_MAXSCALE))));
|
||||
free(tok);
|
||||
token_free(tok);
|
||||
goto retblock;
|
||||
}
|
||||
|
||||
token_free(tok);
|
||||
|
||||
state = HS_INIT;
|
||||
|
||||
while ((tok = hint_next_token(&buf, &ptr)) != NULL
|
||||
&& tok->token != TOK_EOL)
|
||||
{
|
||||
@ -333,8 +346,13 @@ HINT_MODE mode = HM_EXECUTE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
free(tok);
|
||||
}
|
||||
token_free(tok);
|
||||
} /*< while */
|
||||
|
||||
if (tok->token == TOK_EOL)
|
||||
{
|
||||
token_free(tok);
|
||||
}
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
|
Reference in New Issue
Block a user