summaryrefslogtreecommitdiff
path: root/storage/perfschema
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-10 20:09:17 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-10 20:09:17 +0200
commit49501b4ccb923475f259cccf66b90e8c6a5ed0ee (patch)
treeb9a70e644d2e9e2a56227672250f2e8fcaf1b7d7 /storage/perfschema
parent172f5e28ba9efceb3d3cee40c8373d2ee66f7c7a (diff)
downloadmariadb-git-49501b4ccb923475f259cccf66b90e8c6a5ed0ee.tar.gz
fix memory leaks and other problems found by safemalloc
client/mysql_upgrade.c: missing DBUG_RETURN client/mysqladmin.cc: client plugin memory wasn't freed client/mysqlcheck.c: client plugin memory, defaults, a result set, a command-line option value were not freed. missing DBUG_RETURN. client/mysqldump.c: client plugin memory wasn't freed client/mysqlslap.c: client plugin memory wasn't freed client/mysqltest.cc: hopeless. cannot be fixed. mysql-test/valgrind.supp: Bug#56666 is now fixed. mysys/array.c: really, don't allocate if the caller didn't ask to. mysys/my_init.c: safemalloc checks must be done at the very end mysys/my_thr_init.c: not needed anymore sql-common/client.c: memory leak sql/log.cc: log_file was not closed, memory leak. sql/mysqld.cc: fix bug#56666 (causing many P_S related memory leaks). close_active_mi() not called for --bootstrap, memory leak. sql/sql_lex.cc: redo Lex->mi handling sql/sql_lex.h: redo Lex->mi handling sql/sql_plugin.cc: plugins having PLUGIN_VAR_MEMALLOC string variables have this variables allocated in every THD. The memory was freed in ~THD but only if plugin was still active. If plugin was unloaded the variable was not found and the memory was lost. By loading and unloading plugins an arbitrary amount of memory can be lost. sql/sql_repl.cc: redo Lex->mi handling sql/sql_yacc.yy: completely wrong handling of Lex->mi - run-time memory leak, by repeating the statement arbitrary amount of memory can be lost. Lex->mi.repl_ignore_server_ids_opt was allocated when parsing CHANGE MASTER, and freed after executing the statement. if parser failed on syntax (or another) error the statement was never executed. Lex->mi was simply bzero-ed for the next CHANGE MASTER statement. sql/table.cc: didn't compile storage/perfschema/pfs_lock.h: Bug#56666 is fixed
Diffstat (limited to 'storage/perfschema')
-rw-r--r--storage/perfschema/pfs_lock.h13
1 files changed, 1 insertions, 12 deletions
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h
index d253cfa4366..82c34fc2702 100644
--- a/storage/perfschema/pfs_lock.h
+++ b/storage/perfschema/pfs_lock.h
@@ -135,25 +135,14 @@ struct pfs_lock
*/
void allocated_to_free(void)
{
-#ifndef DBUG_OFF
- extern volatile bool ready_to_exit;
-#endif
-
/*
If this record is not in the ALLOCATED state and the caller is trying
to free it, this is a bug: the caller is confused,
and potentially damaging data owned by another thread or object.
The correct assert to use here to guarantee data integrity is simply:
DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED);
- Now, because of Bug#56666 (Race condition between the server main thread
- and the kill server thread), this assert actually fails during shutdown,
- and the failure is legitimate, on concurrent calls to mysql_*_destroy(),
- when destroying the instrumentation of an object ... twice.
- During shutdown this has no consequences for the performance schema,
- so the assert is relaxed with the "|| ready_to_exit" condition as a work
- around until Bug#56666 is fixed.
*/
- DBUG_ASSERT((m_state == PFS_LOCK_ALLOCATED) || ready_to_exit);
+ DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED);
PFS_atomic::store_32(&m_state, PFS_LOCK_FREE);
}