diff options
Diffstat (limited to 'mysys/my_realloc.c')
-rw-r--r-- | mysys/my_realloc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mysys/my_realloc.c b/mysys/my_realloc.c index c7cf1323cd4..a55282e03a0 100644 --- a/mysys/my_realloc.c +++ b/mysys/my_realloc.c @@ -22,6 +22,16 @@ /* My memory re allocator */ +/** + @brief wrapper around realloc() + + @param oldpoint pointer to currently allocated area + @param size new size requested, must be >0 + @param my_flags flags + + @note if size==0 realloc() may return NULL; my_realloc() treats this as an + error which is not the intention of realloc() +*/ void* my_realloc(void* oldpoint, size_t size, myf my_flags) { void *point; @@ -29,6 +39,7 @@ void* my_realloc(void* oldpoint, size_t size, myf my_flags) DBUG_PRINT("my",("ptr: 0x%lx size: %lu my_flags: %d", (long) oldpoint, (ulong) size, my_flags)); + DBUG_ASSERT(size > 0); if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR)) DBUG_RETURN(my_malloc(size,my_flags)); #ifdef USE_HALLOC |