mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Building with compile-pentium-valgrind-max (without safemalloc) defines my_free() without flags,
so a typo on flags will go unnoticed; I put flags in this my_free() definition (as a no-op which will still make the compiler check correctness of the flags). Applied: this caught a typo in my_realloc.c. Kindly approved by Konstantin and Mats.
This commit is contained in:
parent
fb3506f370
commit
621e28cbe1
2 changed files with 3 additions and 2 deletions
|
@ -158,7 +158,8 @@ extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
|
|||
extern char *my_strdup(const char *from,myf MyFlags);
|
||||
extern char *my_strdup_with_length(const byte *from, uint length,
|
||||
myf MyFlags);
|
||||
#define my_free(PTR,FG) my_no_flags_free(PTR)
|
||||
/* we do use FG (as a no-op) in below so that a typo on FG is caught */
|
||||
#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
|
||||
#define CALLER_INFO_PROTO /* nothing */
|
||||
#define CALLER_INFO /* nothing */
|
||||
#define ORIG_CALLER_INFO /* nothing */
|
||||
|
|
|
@ -52,7 +52,7 @@ gptr my_realloc(gptr oldpoint, uint size, myf my_flags)
|
|||
if ((point = (char*)realloc(oldpoint,size)) == NULL)
|
||||
{
|
||||
if (my_flags & MY_FREE_ON_ERROR)
|
||||
my_free(oldpoint,MyFLAGS);
|
||||
my_free(oldpoint, my_flags);
|
||||
if (my_flags & MY_HOLD_ON_ERROR)
|
||||
DBUG_RETURN(oldpoint);
|
||||
my_errno=errno;
|
||||
|
|
Loading…
Reference in a new issue