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

In the blob test code, avoid crashing on low-memory systems by using Tcl_AttemptAlloc().

FossilOrigin-Name: 1d267757a89d9267ee9c201373f801eb9772ab04
This commit is contained in:
mistachkin
2017-02-15 01:39:28 +00:00
parent 0c5cd969b8
commit dd22c09af8
3 changed files with 13 additions and 9 deletions

View File

@@ -239,7 +239,11 @@ static int SQLITE_TCLAPI test_blob_read(
}
if( nByte>0 ){
zBuf = (unsigned char *)Tcl_Alloc(nByte);
zBuf = (unsigned char *)Tcl_AttemptAlloc(nByte);
if( zBuf==0 ){
Tcl_AppendResult(interp, "out of memory", 0);
return TCL_ERROR;
}
}
rc = sqlite3_blob_read(pBlob, zBuf, nByte, iOffset);
if( rc==SQLITE_OK ){