1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Make sqlite3Malloc always return NULL when the number of bytes to allocate

is 0. (CVS 2532)

FossilOrigin-Name: 657d74ebc1d91c99e8ac6cd68fdac3864ebd8d71
This commit is contained in:
drh
2005-06-29 15:33:00 +00:00
parent 54f080e82c
commit ba336867c4
3 changed files with 9 additions and 8 deletions

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.138 2005/06/25 18:42:15 drh Exp $
** $Id: util.c,v 1.139 2005/06/29 15:33:00 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -268,6 +268,7 @@ void sqlite3FreeX(void *p){
*/
void *sqlite3Malloc(int n){
void *p;
if( n==0 ) return 0;
if( (p = malloc(n))==0 ){
if( n>0 ) sqlite3_malloc_failed++;
}else{