summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorunknown <malff/marcsql@weblab.(none)>2007-07-30 23:01:44 -0600
committerunknown <malff/marcsql@weblab.(none)>2007-07-30 23:01:44 -0600
commit7a47324e11dc96fe127025c9b49149d693e96c5c (patch)
treefba968af8bec2ac9bc413609636be1cb30f99094 /sql/log.cc
parente0644f180ef6ba4699aebaf5f81f676082568b8c (diff)
downloadmariadb-git-7a47324e11dc96fe127025c9b49149d693e96c5c.tar.gz
Fixed ressource leak when activation of LOGGER failed.
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/sql/log.cc b/sql/log.cc
index c7a8037d4b5..44804e09b38 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1096,37 +1096,46 @@ void LOGGER::init_general_log(uint general_log_printer)
bool LOGGER::activate_log_handler(THD* thd, uint log_type)
{
+ MYSQL_QUERY_LOG *file_log;
bool res= FALSE;
lock_exclusive();
switch (log_type) {
case QUERY_LOG_SLOW:
if (!opt_slow_log)
{
- file_log_handler->get_mysql_slow_log()->
- open_slow_log(sys_var_slow_log_path.value);
- init_slow_log(log_output_options);
+ file_log= file_log_handler->get_mysql_slow_log();
+
+ file_log->open_slow_log(sys_var_slow_log_path.value);
if (table_log_handler->activate_log(thd, QUERY_LOG_SLOW))
{
/* Error printed by open table in activate_log() */
res= TRUE;
+ file_log->close(0);
}
else
+ {
+ init_slow_log(log_output_options);
opt_slow_log= TRUE;
+ }
}
break;
case QUERY_LOG_GENERAL:
if (!opt_log)
{
- file_log_handler->get_mysql_log()->
- open_query_log(sys_var_general_log_path.value);
- init_general_log(log_output_options);
+ file_log= file_log_handler->get_mysql_log();
+
+ file_log->open_query_log(sys_var_general_log_path.value);
if (table_log_handler->activate_log(thd, QUERY_LOG_GENERAL))
{
/* Error printed by open table in activate_log() */
res= TRUE;
+ file_log->close(0);
}
else
+ {
+ init_general_log(log_output_options);
opt_log= TRUE;
+ }
}
break;
default: