1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

add safemalloc back

... but differently

client/mysqltest.cc:
  my_safe_print_str() don't append \n anymore
dbug/dbug.c:
  restore safemalloc as a part of dbug suite
dbug/user.r:
  restore 'S' flag documentation
include/my_dbug.h:
  restore safemalloc as a part of dbug suite
include/my_sys.h:
  move valgrind defines to a dedicated header
mysys/my_malloc.c:
  use new safemalloc
mysys/stacktrace.c:
  don't append \n. let the calller do it, if needed
sql/mysqld.cc:
  my_safe_print_str() don't append \n anymore
This commit is contained in:
Sergei Golubchik
2011-07-10 19:55:54 +02:00
parent 02b8232629
commit 172f5e28ba
12 changed files with 442 additions and 70 deletions

View File

@ -35,10 +35,10 @@ void *my_malloc(size_t size, myf my_flags)
if (!size)
size=1;
point= malloc(size);
point= DBUG_MALLOC(size);
DBUG_EXECUTE_IF("simulate_out_of_memory",
{
free(point);
my_free(point);
point= NULL;
});
@ -81,7 +81,7 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags)
DBUG_ASSERT(size > 0);
if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
DBUG_RETURN(my_malloc(size, my_flags));
if ((point= realloc(oldpoint, size)) == NULL)
if ((point= DBUG_REALLOC(oldpoint, size)) == NULL)
{
if (my_flags & MY_FREE_ON_ERROR)
my_free(oldpoint);
@ -107,7 +107,7 @@ void my_free(void *ptr)
{
DBUG_ENTER("my_free");
DBUG_PRINT("my",("ptr: %p", ptr));
free(ptr);
DBUG_FREE(ptr);
DBUG_VOID_RETURN;
}