summaryrefslogtreecommitdiff
path: root/ext/mysql/libmysql/safemalloc.c
diff options
context:
space:
mode:
authorMySQL Team <mysql@php.net>2001-01-23 16:48:50 +0000
committerMySQL Team <mysql@php.net>2001-01-23 16:48:50 +0000
commit800f555b707c696798877c80352ded46289e87c4 (patch)
treec540242b6e6da4e9b99b46797a26b215abef0a64 /ext/mysql/libmysql/safemalloc.c
parentd36858681a0d48414702524ebd16f31289b06fa8 (diff)
downloadphp-git-800f555b707c696798877c80352ded46289e87c4.tar.gz
Upgrade ext/mysql/libmysql to version 3.23.32. One notable bug fix is
that the client can now connect to a server which is using a default charset other than latin1.
Diffstat (limited to 'ext/mysql/libmysql/safemalloc.c')
-rw-r--r--ext/mysql/libmysql/safemalloc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/mysql/libmysql/safemalloc.c b/ext/mysql/libmysql/safemalloc.c
index db62b7f3e3..1918034c19 100644
--- a/ext/mysql/libmysql/safemalloc.c
+++ b/ext/mysql/libmysql/safemalloc.c
@@ -59,6 +59,8 @@ This file is public domain and comes with NO WARRANTY of any kind */
#include "my_static.h"
#include "mysys_err.h"
+ulonglong safemalloc_mem_limit = ~(ulonglong)0;
+
#define pNext tInt._pNext
#define pPrev tInt._pPrev
#define sFileName tInt._sFileName
@@ -111,11 +113,15 @@ gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags)
DBUG_ENTER("_mymalloc");
DBUG_PRINT("enter",("Size: %u",uSize));
+
if (!sf_malloc_quick)
(void) _sanity (sFile, uLine);
- /* Allocate the physical memory */
- pTmp = (struct remember *) malloc (
+ if(uSize + lCurMemory > safemalloc_mem_limit)
+ pTmp = 0;
+ else
+ /* Allocate the physical memory */
+ pTmp = (struct remember *) malloc (
sizeof (struct irem) /* remember data */
+ sf_malloc_prehunc
+ uSize /* size requested */