mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-05 04:30:38 +03:00
Fix a bug on systems where malloc(0) return NULL.
Add code to detect this bug even on systems were it used not to occur. (CVS 190) FossilOrigin-Name: bda83e2b75843b9a078c2f4e64fcd4d2145a716b
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
** This file contains functions for allocating memory, comparing
|
||||
** strings, and stuff like that.
|
||||
**
|
||||
** $Id: util.c,v 1.17 2000/12/10 18:23:51 drh Exp $
|
||||
** $Id: util.c,v 1.18 2001/03/14 12:35:57 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdarg.h>
|
||||
@@ -60,6 +60,7 @@ void *sqliteMalloc_(int n, char *zFile, int line){
|
||||
sqlite_iMallocFail--;
|
||||
if( sqlite_iMallocFail==0 ) return 0;
|
||||
}
|
||||
if( n==0 ) return 0;
|
||||
k = (n+sizeof(int)-1)/sizeof(int);
|
||||
pi = malloc( (3+k)*sizeof(int));
|
||||
if( pi==0 ) return 0;
|
||||
|
||||
Reference in New Issue
Block a user