1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Add the ability to simulate out-of-memory errors when using the default

memory allocator, mem1.c.  Fix a bug that this enhancement revealed. (CVS 4875)

FossilOrigin-Name: d55a5e1c11ef90534abd2e5f18d06dd4739ade70
This commit is contained in:
drh
2008-03-18 00:07:10 +00:00
parent 0e8ebe5168
commit 5efaf07099
6 changed files with 38 additions and 33 deletions

View File

@@ -13,7 +13,7 @@
** This file contains code used to implement test interfaces to the
** memory allocation subsystem.
**
** $Id: test_malloc.c,v 1.15 2008/02/19 15:15:16 drh Exp $
** $Id: test_malloc.c,v 1.16 2008/03/18 00:07:11 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -463,18 +463,14 @@ static int test_memdebug_pending(
int objc,
Tcl_Obj *CONST objv[]
){
int nPending;
if( objc!=1 ){
Tcl_WrongNumArgs(interp, 1, objv, "");
return TCL_ERROR;
}
#if defined(SQLITE_MEMDEBUG) || defined(SQLITE_POW2_MEMORY_SIZE)
{
int nPending = sqlite3_test_control(SQLITE_TESTCTRL_FAULT_PENDING,
SQLITE_FAULTINJECTOR_MALLOC);
Tcl_SetObjResult(interp, Tcl_NewIntObj(nPending));
}
#endif
nPending = sqlite3_test_control(SQLITE_TESTCTRL_FAULT_PENDING,
SQLITE_FAULTINJECTOR_MALLOC);
Tcl_SetObjResult(interp, Tcl_NewIntObj(nPending));
return TCL_OK;
}