aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2008-06-23 15:10:24 +0000
committerdanielk1977 <danielk1977@noemail.net>2008-06-23 15:10:24 +0000
commit950292fbb8058a6a0fc3ef426533d789269da60c (patch)
tree962240f6bab0de69ac2104f75e9bebc0ad764757 /src
parent834a5aab16f3d767f0ac8ca59fcf4a462eef3c9b (diff)
downloadsqlite-950292fbb8058a6a0fc3ef426533d789269da60c.tar.gz
sqlite-950292fbb8058a6a0fc3ef426533d789269da60c.zip
Handle a real system malloc() failure in mem1.c. (CVS 5281)
FossilOrigin-Name: 006fd69bf56f05448fd9aa82d3b1cdcc175369ad
Diffstat (limited to 'src')
-rw-r--r--src/mem1.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mem1.c b/src/mem1.c
index 8cd71b875..7f164f8ce 100644
--- a/src/mem1.c
+++ b/src/mem1.c
@@ -17,7 +17,7 @@
** This file contains implementations of the low-level memory allocation
** routines specified in the sqlite3_mem_methods object.
**
-** $Id: mem1.c,v 1.22 2008/06/23 14:40:18 danielk1977 Exp $
+** $Id: mem1.c,v 1.23 2008/06/23 15:10:25 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -41,8 +41,11 @@ static void *sqlite3MemMalloc(int nByte){
assert( nByte>0 );
nByte = (nByte+7)&~7;
p = malloc( nByte+8 );
- p[0] = nByte;
- return (void*)&p[1];
+ if( p ){
+ p[0] = nByte;
+ p++;
+ }
+ return (void *)p;
}
/*