summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@oracle.com>2011-11-29 20:17:02 +0200
committerAndrei Elkin <andrei.elkin@oracle.com>2011-11-29 20:17:02 +0200
commit9937d5f0a91bb8fdceb7d2110e22c03878242a29 (patch)
tree7a65eba20838c82ea32a01a93846d1ca9203e384 /sql/sql_lex.h
parentbd49125dd906fdbd51dd81e89ec8cfa1d553e022 (diff)
downloadmariadb-git-9937d5f0a91bb8fdceb7d2110e22c03878242a29.tar.gz
Bug#13437900 - VALGRIND REPORTS A LEAK FOR REPL_IGNORE_SERVER_IDS
There was memory leak when running some tests on PB2. The reason of the failure is an early return from change_master() that was supposed to deallocate a dyn-array. Fixed with relocating the dyn-array's destructor at ~LEX() that is the end of the session, per Gleb's patch idea. Two optimizations were done: the static buffer for the dyn-array to base on, and the array initialization is called precisely when it's necessary rather than per each CHANGE-MASTER as before.
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 542e8b42ae2..474fa87495b 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -291,7 +291,9 @@ typedef struct st_lex_master_info
char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher;
char *relay_log_name;
ulong relay_log_pos;
+ bool repl_ignore_server_ids_inited;
DYNAMIC_ARRAY repl_ignore_server_ids;
+ typeof(::server_id) repl_ignore_server_ids_static_buffer[4];
} LEX_MASTER_INFO;
typedef struct st_lex_reset_slave
@@ -2455,6 +2457,11 @@ struct LEX: public Query_tables_list
destroy_query_tables_list();
plugin_unlock_list(NULL, (plugin_ref *)plugins.buffer, plugins.elements);
delete_dynamic(&plugins);
+ if (mi.repl_ignore_server_ids_inited)
+ {
+ delete_dynamic(&mi.repl_ignore_server_ids);
+ mi.repl_ignore_server_ids_inited= false;
+ }
}
inline bool is_ps_or_view_context_analysis()