diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-07-10 20:09:17 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-07-10 20:09:17 +0200 |
commit | 49501b4ccb923475f259cccf66b90e8c6a5ed0ee (patch) | |
tree | b9a70e644d2e9e2a56227672250f2e8fcaf1b7d7 /mysys/array.c | |
parent | 172f5e28ba9efceb3d3cee40c8373d2ee66f7c7a (diff) | |
download | mariadb-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 'mysys/array.c')
-rw-r--r-- | mysys/array.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mysys/array.c b/mysys/array.c index 164e62bd9f9..83a879768c4 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -61,7 +61,8 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, Since the dynamic array is usable even if allocation fails here malloc should not throw an error */ - if (!(array->buffer= (uchar*) my_malloc(element_size*init_alloc, MYF(0)))) + if (init_alloc && + !(array->buffer= (uchar*) my_malloc(element_size*init_alloc, MYF(0)))) array->max_element=0; DBUG_RETURN(FALSE); } |