diff options
Diffstat (limited to 'ext/mysql/libmysql/safemalloc.c')
-rw-r--r-- | ext/mysql/libmysql/safemalloc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/mysql/libmysql/safemalloc.c b/ext/mysql/libmysql/safemalloc.c index 5a44745bed..db62b7f3e3 100644 --- a/ext/mysql/libmysql/safemalloc.c +++ b/ext/mysql/libmysql/safemalloc.c @@ -1,5 +1,5 @@ -/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB +This file is public domain and comes with NO WARRANTY of any kind */ /* * [This posting refers to an article entitled "oops, corrupted memory @@ -193,7 +193,7 @@ gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags) * Free then old memoryblock */ -gptr _myrealloc (register my_string pPtr, register uint uSize, +gptr _myrealloc (register gptr pPtr, register uint uSize, const char *sFile, uint uLine, myf MyFlags) { struct remember *pRec; @@ -209,7 +209,8 @@ gptr _myrealloc (register my_string pPtr, register uint uSize, if (check_ptr("Reallocating",(byte*) pPtr,sFile,uLine)) DBUG_RETURN((gptr) NULL); - pRec = (struct remember *) (pPtr - sizeof (struct irem)-sf_malloc_prehunc); + pRec = (struct remember *) ((char*) pPtr - sizeof (struct irem)- + sf_malloc_prehunc); if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) != MAGICKEY) { @@ -467,6 +468,7 @@ int _sanity (const char *sFile, uint uLine) count=cNewCount; for (pTmp = pRememberRoot; pTmp != NULL && count-- ; pTmp = pTmp -> pNext) flag+=_checkchunk (pTmp, sFile, uLine); + pthread_mutex_unlock(&THR_LOCK_malloc); if (count || pTmp) { const char *format="Safemalloc link list destroyed, discovered at '%s:%d'"; @@ -475,7 +477,6 @@ int _sanity (const char *sFile, uint uLine) DBUG_PRINT("safe",(format, sFile, uLine)); flag=1; } - pthread_mutex_unlock(&THR_LOCK_malloc); return flag; } /* _sanity */ |