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

Add the SQLITE_NOMEM_BKPT macro to enhance the ability to debug OOM errors.

Only effective with compiling with SQLITE_DEBUG.

FossilOrigin-Name: 9b3454762d142113f5923d754ca6bd2edefbd362
This commit is contained in:
drh
2016-02-15 18:15:15 +00:00
37 changed files with 289 additions and 272 deletions

View File

@@ -1,5 +1,5 @@
C Minor\scode\ssimplifications. C Add\sthe\sSQLITE_NOMEM_BKPT\smacro\sto\senhance\sthe\sability\sto\sdebug\sOOM\serrors.\nOnly\seffective\swith\scompiling\swith\sSQLITE_DEBUG.
D 2016-02-15T18:02:13.822 D 2016-02-15T18:15:15.015
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347 F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347
@@ -285,21 +285,21 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c 7603afbd61f55e7c644b8de4a42f33e58c0b7eaa F src/alter.c 7603afbd61f55e7c644b8de4a42f33e58c0b7eaa
F src/analyze.c b148441c7d35b5514ec1a66f9df97be8fa4c68a1 F src/analyze.c ab57b6763dd4c6170a20673d14882c033affd188
F src/attach.c 07aa6e77c3906d46d4c36d7c81641dedd6adac91 F src/attach.c a3724c64de1099d85e30751213d285752aed9505
F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc F src/backup.c f60f0aa55d25d853ffde53d0b0370a7bb7ee41ce
F src/bitvec.c 1a78d450a17c5016710eec900bedfc5729bf9bdf F src/bitvec.c 3ee4c8b2c94ed3a7377256e18199e6ff5cf33f63
F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73
F src/btree.c 4c8caaeed7878aafdb607c3d2bcbc365bb0d19a1 F src/btree.c 474ad91c1684e9053da64fa88747a1cb0c10d034
F src/btree.h 368ceeb4bd9312dc8df2ffd64b4b7dbcf4db5f8e F src/btree.h 368ceeb4bd9312dc8df2ffd64b4b7dbcf4db5f8e
F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5
F src/build.c 7bc84362e4073841df1a24273e5bf87ddf46199f F src/build.c 88f185a37d1e087818fd7077d84d65c5babefdb1
F src/callback.c 0643b8fb06c95a8977beb201b268210d4b131a22 F src/callback.c 0643b8fb06c95a8977beb201b268210d4b131a22
F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198 F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
F src/date.c 0b73e681c11fca867fec554750c07fe0d4e417c1 F src/date.c 0b73e681c11fca867fec554750c07fe0d4e417c1
F src/dbstat.c b2ec6793eef97aebb4d171d490a4ffdfa9f2475c F src/dbstat.c c845548d4346e606e2f2b7d2e714ace2b8a7dd1b
F src/delete.c 48802aa3ee6339f576d074336d3ae1b5f40e240f F src/delete.c 48802aa3ee6339f576d074336d3ae1b5f40e240f
F src/expr.c 9adb58153f6e943b703d43e9a1f67f77b5a75721 F src/expr.c 9adb58153f6e943b703d43e9a1f67f77b5a75721
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
@@ -310,17 +310,17 @@ F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094 F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
F src/insert.c 9ca97272e9f74ed0efddf3b4350ee12740cebbef F src/insert.c 9ca97272e9f74ed0efddf3b4350ee12740cebbef
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/journal.c fe3a3e2559ce3ce9d371afd30fbabbc074174575
F src/legacy.c b1b0880fc474abfab89e737b0ecfde0bd7a60902 F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e
F src/loadext.c 84996d7d70a605597d79c1f1d7b2012a5fd34f2b F src/loadext.c 9e2a41adcaff16ebc1ebff1f336cbf33de55396f
F src/main.c 17cfc8ba39fd86bc8201213140db53a65ff3cf2a F src/main.c 8d2fd210bfbf2f28becb9452641c5689760a68d4
F src/malloc.c 337e9808b5231855fe28857950f4f60ae42c417f F src/malloc.c 1443d1ad95d67c21d77af7ae3f44678252f0efec
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a
F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944 F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85 F src/memjournal.c 349a04fb803db40532cde0993e39758f1acaecce
F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495 F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495
F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
@@ -328,35 +328,35 @@ F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
F src/mutex_unix.c 27bb6cc49485ee46711a6580ab7b3f1402211d23 F src/mutex_unix.c 27bb6cc49485ee46711a6580ab7b3f1402211d23
F src/mutex_w32.c 5e6fe1c298fb5a8a15aaed4161d5759311431c17 F src/mutex_w32.c 5e6fe1c298fb5a8a15aaed4161d5759311431c17
F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7 F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7
F src/os.c 205fa2bad945a0dc7cad48f9f95ea3e8dc5408ff F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c 821ed110197175165cf2f50b0930c7ff9a24504c F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35
F src/os_win.c ccf29ddded3e41e506b6bd98c1171aa0963b23f2 F src/os_win.c 6cce4c3aab5fb5cc6fabf999d785cfccb66ff9d4
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c 67cd2fbab58d0e35fed5f81432856f4f0af9fc6d F src/pager.c 6812f3803951774b56abded396171e1c12b0b003
F src/pager.h f3eb324a3ff2408b28bab7e81c1c55c13720f865 F src/pager.h f3eb324a3ff2408b28bab7e81c1c55c13720f865
F src/parse.y d7bff41d460f2df96fb890f36700e85cb0fc5634 F src/parse.y d7bff41d460f2df96fb890f36700e85cb0fc5634
F src/pcache.c 73895411fa6b7bd6f0091212feabbe833b358d23 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df
F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545 F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545
F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051 F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051
F src/pragma.c 80ee77226d0008d9188356a6cbbe6010866e1bee F src/pragma.c 80ee77226d0008d9188356a6cbbe6010866e1bee
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
F src/prepare.c c12b786713df3e8270c0f85f988c5359d8b4d87c F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e
F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26 F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20
F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e
F src/select.c ff80004a9a6ece891a8d9327a88e7b6e2588ee6d F src/select.c 1a7e23a3bb2edb9cdc46ab0cf7c1500109cf2531
F src/shell.c 0367440658104bf2ce8d8a9a5a713a4b11c9acbe F src/shell.c 0367440658104bf2ce8d8a9a5a713a4b11c9acbe
F src/sqlite.h.in f80c6ebd85588fc514bfedf3ecb00cec269cb410 F src/sqlite.h.in f80c6ebd85588fc514bfedf3ecb00cec269cb410
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
F src/sqliteInt.h ddd4a48f3ac2a423f003027e73bd8422bfa4d991 F src/sqliteInt.h e2ed86c6f5c3e503bbd07328737342afedfe48fc
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
F src/tclsqlite.c 13debcc6a5ca1217486f8903768c01114fbe8b58 F src/tclsqlite.c 13debcc6a5ca1217486f8903768c01114fbe8b58
F src/test1.c 4f1b42699068b7806af3111786f5ad760c2c1ff7 F src/test1.c 4f1b42699068b7806af3111786f5ad760c2c1ff7
F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b
@@ -405,29 +405,29 @@ F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
F src/test_windirent.c 8f5fada630348558d5745b334702f301da1ffc61 F src/test_windirent.c 8f5fada630348558d5745b334702f301da1ffc61
F src/test_windirent.h b12055cab6227f7be10f5c19296f67c60cc5e2a5 F src/test_windirent.h b12055cab6227f7be10f5c19296f67c60cc5e2a5
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c bbfb74450643cb5372a43ad4f6cffd7e9dfcecb0 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 813934be70597edfbb685ae08fc4c8b549cf5a1e F src/tokenize.c 2a234093ff16791ab3ec5ab60dc7fcf6af575e1c
F src/treeview.c dc39ccf04e9331237388b9cb73289c9d87ea050b F src/treeview.c dc39ccf04e9331237388b9cb73289c9d87ea050b
F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280 F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280
F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca
F src/utf.c 10cc2519e82e3369344d0969ad4b1a333dc86d18 F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
F src/util.c 8073bbdab9cc7209f6741bd44264ede606cbadc6 F src/util.c 8073bbdab9cc7209f6741bd44264ede606cbadc6
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701 F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52
F src/vdbe.c c193299e595a13eba247738e22fce25c49346a6c F src/vdbe.c ad4d5b7ad65793886b09c925fb5d1d74ac78f1a4
F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512 F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512
F src/vdbeInt.h 4b69d5451bcadd473e745af53ef1e8abfdce0a79 F src/vdbeInt.h 4b69d5451bcadd473e745af53ef1e8abfdce0a79
F src/vdbeapi.c 9324f6baee1a1b2284c6543e98f916888a81e459 F src/vdbeapi.c bfc06382d5089944388a90e4f90bb1e975b3613d
F src/vdbeaux.c deae5d3bd45da0e57c7d9e1d7436333d142dc3bb F src/vdbeaux.c 3580de0325a05663195d8f8fddf48c6dd9a28522
F src/vdbeblob.c 3b570b730109e8f653d9d2081649f6e7015113db F src/vdbeblob.c 3b570b730109e8f653d9d2081649f6e7015113db
F src/vdbemem.c e0dbb7bb9c2ec566c53c6575b4f51b3fcd426811 F src/vdbemem.c be8381ed6de54eb9cb9dfa802823cdeb5166d855
F src/vdbesort.c ef3c6d1f1a7d44cf67bb2bee59ea3d1fe5bad174 F src/vdbesort.c 74c22db608649fd7ed2d19d53eefb6efb14e9ee0
F src/vdbetrace.c f75c5455d8cf389ef86a8bfdfd3177e0e3692484 F src/vdbetrace.c f75c5455d8cf389ef86a8bfdfd3177e0e3692484
F src/vtab.c bef51b4f693d82b4b0184457faa8625654534091 F src/vtab.c c27c0232bbc6bd4b50320ea0ef988334cde7d1ca
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 1dd3f1aeed5765be62f27d7d2e44d46a68d891ab F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b
F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c
F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354 F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354
F src/where.c 984084584c10c41e46c89ac027a5cca991bc37e6 F src/where.c 5b67fb8035ae4697cf721db095f800ef8dff5f56
F src/whereInt.h 78b6b4de94db84aecbdc07fe3e38f648eb391e9a F src/whereInt.h 78b6b4de94db84aecbdc07fe3e38f648eb391e9a
F src/wherecode.c 791a784bbf8749d560fdb0b990b607bc4f44a38d F src/wherecode.c 791a784bbf8749d560fdb0b990b607bc4f44a38d
F src/whereexpr.c de117970b29471177a6901d60ad83a194671dc03 F src/whereexpr.c de117970b29471177a6901d60ad83a194671dc03
@@ -1427,7 +1427,8 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 7d49ed32a7262ec95d72ce520ab75402633386a1 a863729ccb75a56330460d3b7d558e639ad733d1 P c3b38efd50c3c07b6dee5dea4c1f95b37d1c0994 e9753d9a2c1269050f886e6cb9bc9cba0a8df6ce
R 93e8a74312f81836d6df6da0bc830b92 R b0fc853e4a1dd4125cb33093c5176aa5
T +closed e9753d9a2c1269050f886e6cb9bc9cba0a8df6ce
U drh U drh
Z 4954abce0b42594f953ecc9e37768bc0 Z 3f49c178a99d041b6eb9f7c9f8c2a0a3

View File

@@ -1 +1 @@
c3b38efd50c3c07b6dee5dea4c1f95b37d1c0994 9b3454762d142113f5923d754ca6bd2edefbd362

View File

@@ -1670,7 +1670,7 @@ static int loadStatTbl(
assert( db->lookaside.bDisable ); assert( db->lookaside.bDisable );
zSql = sqlite3MPrintf(db, zSql1, zDb); zSql = sqlite3MPrintf(db, zSql1, zDb);
if( !zSql ){ if( !zSql ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
sqlite3DbFree(db, zSql); sqlite3DbFree(db, zSql);
@@ -1710,7 +1710,7 @@ static int loadStatTbl(
pIdx->aSample = sqlite3DbMallocZero(db, nByte); pIdx->aSample = sqlite3DbMallocZero(db, nByte);
if( pIdx->aSample==0 ){ if( pIdx->aSample==0 ){
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pSpace = (tRowcnt*)&pIdx->aSample[nSample]; pSpace = (tRowcnt*)&pIdx->aSample[nSample];
pIdx->aAvgEq = pSpace; pSpace += nIdxCol; pIdx->aAvgEq = pSpace; pSpace += nIdxCol;
@@ -1726,7 +1726,7 @@ static int loadStatTbl(
zSql = sqlite3MPrintf(db, zSql2, zDb); zSql = sqlite3MPrintf(db, zSql2, zDb);
if( !zSql ){ if( !zSql ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
sqlite3DbFree(db, zSql); sqlite3DbFree(db, zSql);
@@ -1764,7 +1764,7 @@ static int loadStatTbl(
pSample->p = sqlite3DbMallocZero(db, pSample->n + 2); pSample->p = sqlite3DbMallocZero(db, pSample->n + 2);
if( pSample->p==0 ){ if( pSample->p==0 ){
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n); memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);
pIdx->nSample++; pIdx->nSample++;
@@ -1853,7 +1853,7 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
zSql = sqlite3MPrintf(db, zSql = sqlite3MPrintf(db,
"SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase); "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase);
if( zSql==0 ){ if( zSql==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0); rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);
sqlite3DbFree(db, zSql); sqlite3DbFree(db, zSql);

View File

@@ -144,7 +144,7 @@ static void attachFunc(
Pager *pPager; Pager *pPager;
aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt); aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);
if( !aNew->pSchema ){ if( !aNew->pSchema ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){ }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
zErrDyn = sqlite3MPrintf(db, zErrDyn = sqlite3MPrintf(db,
"attached databases must use the same text encoding as main database"); "attached databases must use the same text encoding as main database");
@@ -164,7 +164,7 @@ static void attachFunc(
aNew->safety_level = 3; aNew->safety_level = 3;
aNew->zName = sqlite3DbStrDup(db, zName); aNew->zName = sqlite3DbStrDup(db, zName);
if( rc==SQLITE_OK && aNew->zName==0 ){ if( rc==SQLITE_OK && aNew->zName==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }

View File

@@ -88,7 +88,7 @@ static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
pParse = sqlite3StackAllocZero(pErrorDb, sizeof(*pParse)); pParse = sqlite3StackAllocZero(pErrorDb, sizeof(*pParse));
if( pParse==0 ){ if( pParse==0 ){
sqlite3ErrorWithMsg(pErrorDb, SQLITE_NOMEM, "out of memory"); sqlite3ErrorWithMsg(pErrorDb, SQLITE_NOMEM, "out of memory");
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
pParse->db = pDb; pParse->db = pDb;
if( sqlite3OpenTempDatabase(pParse) ){ if( sqlite3OpenTempDatabase(pParse) ){
@@ -182,7 +182,7 @@ sqlite3_backup *sqlite3_backup_init(
** sqlite3_backup_finish(). */ ** sqlite3_backup_finish(). */
p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup)); p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup));
if( !p ){ if( !p ){
sqlite3Error(pDestDb, SQLITE_NOMEM); sqlite3Error(pDestDb, SQLITE_NOMEM_BKPT);
} }
} }
@@ -581,7 +581,7 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
} }
if( rc==SQLITE_IOERR_NOMEM ){ if( rc==SQLITE_IOERR_NOMEM ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
p->rc = rc; p->rc = rc;
} }

View File

@@ -177,7 +177,7 @@ int sqlite3BitvecSet(Bitvec *p, u32 i){
i = i%p->iDivisor; i = i%p->iDivisor;
if( p->u.apSub[bin]==0 ){ if( p->u.apSub[bin]==0 ){
p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor ); p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );
if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM; if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM_BKPT;
} }
p = p->u.apSub[bin]; p = p->u.apSub[bin];
} }
@@ -212,7 +212,7 @@ bitvec_set_rehash:
int rc; int rc;
u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash)); u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash));
if( aiValues==0 ){ if( aiValues==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
}else{ }else{
memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash)); memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));
memset(p->u.apSub, 0, sizeof(p->u.apSub)); memset(p->u.apSub, 0, sizeof(p->u.apSub));

View File

@@ -350,7 +350,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
if( !pLock ){ if( !pLock ){
pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock)); pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock));
if( !pLock ){ if( !pLock ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pLock->iTable = iTable; pLock->iTable = iTable;
pLock->pBtree = p; pLock->pBtree = p;
@@ -553,7 +553,7 @@ static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
assert( pgno<=pBt->nPage ); assert( pgno<=pBt->nPage );
pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage); pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage);
if( !pBt->pHasContent ){ if( !pBt->pHasContent ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
} }
if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){ if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
@@ -632,7 +632,7 @@ static int saveCursorKey(BtCursor *pCur){
sqlite3_free(pKey); sqlite3_free(pKey);
} }
}else{ }else{
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
} }
assert( !pCur->curIntKey || !pCur->pKey ); assert( !pCur->curIntKey || !pCur->pKey );
@@ -764,7 +764,7 @@ static int btreeMoveto(
pIdxKey = sqlite3VdbeAllocUnpackedRecord( pIdxKey = sqlite3VdbeAllocUnpackedRecord(
pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
); );
if( pIdxKey==0 ) return SQLITE_NOMEM; if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT;
sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey); sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey);
if( pIdxKey->nField==0 ){ if( pIdxKey->nField==0 ){
sqlite3DbFree(pCur->pKeyInfo->db, pFree); sqlite3DbFree(pCur->pKeyInfo->db, pFree);
@@ -2176,7 +2176,7 @@ int sqlite3BtreeOpen(
} }
p = sqlite3MallocZero(sizeof(Btree)); p = sqlite3MallocZero(sizeof(Btree));
if( !p ){ if( !p ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
p->inTrans = TRANS_NONE; p->inTrans = TRANS_NONE;
p->db = db; p->db = db;
@@ -2200,7 +2200,7 @@ int sqlite3BtreeOpen(
p->sharable = 1; p->sharable = 1;
if( !zFullPathname ){ if( !zFullPathname ){
sqlite3_free(p); sqlite3_free(p);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
if( isMemdb ){ if( isMemdb ){
memcpy(zFullPathname, zFilename, nFilename); memcpy(zFullPathname, zFilename, nFilename);
@@ -2268,7 +2268,7 @@ int sqlite3BtreeOpen(
pBt = sqlite3MallocZero( sizeof(*pBt) ); pBt = sqlite3MallocZero( sizeof(*pBt) );
if( pBt==0 ){ if( pBt==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto btree_open_out; goto btree_open_out;
} }
rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename, rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
@@ -2337,7 +2337,7 @@ int sqlite3BtreeOpen(
if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){ if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){
pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST); pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
if( pBt->mutex==0 ){ if( pBt->mutex==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto btree_open_out; goto btree_open_out;
} }
} }
@@ -4114,7 +4114,7 @@ static int btreeCursor(
if( wrFlag ){ if( wrFlag ){
allocateTempSpace(pBt); allocateTempSpace(pBt);
if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM; if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT;
} }
if( iTable==1 && btreePagecount(pBt)==0 ){ if( iTable==1 && btreePagecount(pBt)==0 ){
assert( wrFlag==0 ); assert( wrFlag==0 );
@@ -4512,7 +4512,7 @@ static int accessPayload(
pCur->aOverflow, nOvfl*2*sizeof(Pgno) pCur->aOverflow, nOvfl*2*sizeof(Pgno)
); );
if( aNew==0 ){ if( aNew==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
pCur->nOvflAlloc = nOvfl*2; pCur->nOvflAlloc = nOvfl*2;
pCur->aOverflow = aNew; pCur->aOverflow = aNew;
@@ -5217,7 +5217,7 @@ int sqlite3BtreeMovetoUnpacked(
} }
pCellKey = sqlite3Malloc( nCell+18 ); pCellKey = sqlite3Malloc( nCell+18 );
if( pCellKey==0 ){ if( pCellKey==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto moveto_finish; goto moveto_finish;
} }
pCur->aiIdx[pCur->iPage] = (u16)idx; pCur->aiIdx[pCur->iPage] = (u16)idx;
@@ -7036,7 +7036,7 @@ static int balance_nonroot(
assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx ); assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
if( !aOvflSpace ){ if( !aOvflSpace ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
/* Find the sibling pages to balance. Also locate the cells in pParent /* Find the sibling pages to balance. Also locate the cells in pParent
@@ -7136,7 +7136,7 @@ static int balance_nonroot(
assert( szScratch<=6*(int)pBt->pageSize ); assert( szScratch<=6*(int)pBt->pageSize );
b.apCell = sqlite3ScratchMalloc( szScratch ); b.apCell = sqlite3ScratchMalloc( szScratch );
if( b.apCell==0 ){ if( b.apCell==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto balance_cleanup; goto balance_cleanup;
} }
b.szCell = (u16*)&b.apCell[nMaxCells]; b.szCell = (u16*)&b.apCell[nMaxCells];

View File

@@ -923,7 +923,7 @@ void sqlite3StartTable(
pTable = sqlite3DbMallocZero(db, sizeof(Table)); pTable = sqlite3DbMallocZero(db, sizeof(Table));
if( pTable==0 ){ if( pTable==0 ){
assert( db->mallocFailed ); assert( db->mallocFailed );
pParse->rc = SQLITE_NOMEM; pParse->rc = SQLITE_NOMEM_BKPT;
pParse->nErr++; pParse->nErr++;
goto begin_table_error; goto begin_table_error;
} }
@@ -1604,7 +1604,7 @@ static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
assert( pIdx->isResized==0 ); assert( pIdx->isResized==0 );
nByte = (sizeof(char*) + sizeof(i16) + 1)*N; nByte = (sizeof(char*) + sizeof(i16) + 1)*N;
zExtra = sqlite3DbMallocZero(db, nByte); zExtra = sqlite3DbMallocZero(db, nByte);
if( zExtra==0 ) return SQLITE_NOMEM; if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn); memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
pIdx->azColl = (const char**)zExtra; pIdx->azColl = (const char**)zExtra;
zExtra += sizeof(char*)*N; zExtra += sizeof(char*)*N;

View File

@@ -281,7 +281,7 @@ int sqlite3_complete16(const void *zSql){
if( zSql8 ){ if( zSql8 ){
rc = sqlite3_complete(zSql8); rc = sqlite3_complete(zSql8);
}else{ }else{
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
sqlite3ValueFree(pVal); sqlite3ValueFree(pVal);
return rc & 0xff; return rc & 0xff;

View File

@@ -162,7 +162,7 @@ static int statConnect(
rc = sqlite3_declare_vtab(db, VTAB_SCHEMA); rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable)); pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
if( pTab==0 ) rc = SQLITE_NOMEM; if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
} }
assert( rc==SQLITE_OK || pTab==0 ); assert( rc==SQLITE_OK || pTab==0 );
@@ -243,7 +243,7 @@ static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor)); pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor));
if( pCsr==0 ){ if( pCsr==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
}else{ }else{
memset(pCsr, 0, sizeof(StatCursor)); memset(pCsr, 0, sizeof(StatCursor));
pCsr->base.pVtab = pVTab; pCsr->base.pVtab = pVTab;
@@ -349,7 +349,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){
nUsable = szPage - sqlite3BtreeGetReserveNoMutex(pBt); nUsable = szPage - sqlite3BtreeGetReserveNoMutex(pBt);
sqlite3BtreeLeave(pBt); sqlite3BtreeLeave(pBt);
p->aCell = sqlite3_malloc64((p->nCell+1) * sizeof(StatCell)); p->aCell = sqlite3_malloc64((p->nCell+1) * sizeof(StatCell));
if( p->aCell==0 ) return SQLITE_NOMEM; if( p->aCell==0 ) return SQLITE_NOMEM_BKPT;
memset(p->aCell, 0, (p->nCell+1) * sizeof(StatCell)); memset(p->aCell, 0, (p->nCell+1) * sizeof(StatCell));
for(i=0; i<p->nCell; i++){ for(i=0; i<p->nCell; i++){
@@ -382,7 +382,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){
pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4); pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4);
pCell->nOvfl = nOvfl; pCell->nOvfl = nOvfl;
pCell->aOvfl = sqlite3_malloc64(sizeof(u32)*nOvfl); pCell->aOvfl = sqlite3_malloc64(sizeof(u32)*nOvfl);
if( pCell->aOvfl==0 ) return SQLITE_NOMEM; if( pCell->aOvfl==0 ) return SQLITE_NOMEM_BKPT;
pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]); pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]);
for(j=1; j<nOvfl; j++){ for(j=1; j<nOvfl; j++){
int rc; int rc;
@@ -461,7 +461,7 @@ statNextRestart:
pCsr->aPage[0].iCell = 0; pCsr->aPage[0].iCell = 0;
pCsr->aPage[0].zPath = z = sqlite3_mprintf("/"); pCsr->aPage[0].zPath = z = sqlite3_mprintf("/");
pCsr->iPage = 0; pCsr->iPage = 0;
if( z==0 ) rc = SQLITE_NOMEM; if( z==0 ) rc = SQLITE_NOMEM_BKPT;
}else{ }else{
pCsr->isEof = 1; pCsr->isEof = 1;
return sqlite3_reset(pCsr->pStmt); return sqlite3_reset(pCsr->pStmt);
@@ -496,7 +496,7 @@ statNextRestart:
} }
pCell->iOvfl++; pCell->iOvfl++;
statSizeAndOffset(pCsr); statSizeAndOffset(pCsr);
return z==0 ? SQLITE_NOMEM : SQLITE_OK; return z==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;
} }
if( p->iRightChildPg ) break; if( p->iRightChildPg ) break;
p->iCell++; p->iCell++;
@@ -520,7 +520,7 @@ statNextRestart:
p[1].iCell = 0; p[1].iCell = 0;
p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
p->iCell++; p->iCell++;
if( z==0 ) rc = SQLITE_NOMEM; if( z==0 ) rc = SQLITE_NOMEM_BKPT;
} }
@@ -554,7 +554,7 @@ statNextRestart:
pCsr->nUnused = p->nUnused; pCsr->nUnused = p->nUnused;
pCsr->nMxPayload = p->nMxPayload; pCsr->nMxPayload = p->nMxPayload;
pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath); pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath);
if( z==0 ) rc = SQLITE_NOMEM; if( z==0 ) rc = SQLITE_NOMEM_BKPT;
nPayload = 0; nPayload = 0;
for(i=0; i<p->nCell; i++){ for(i=0; i<p->nCell; i++){
nPayload += p->aCell[i].nLocal; nPayload += p->aCell[i].nLocal;
@@ -588,7 +588,7 @@ static int statFilter(
if( pCsr->iDb<0 ){ if( pCsr->iDb<0 ){
sqlite3_free(pCursor->pVtab->zErrMsg); sqlite3_free(pCursor->pVtab->zErrMsg);
pCursor->pVtab->zErrMsg = sqlite3_mprintf("no such schema: %s", zDbase); pCursor->pVtab->zErrMsg = sqlite3_mprintf("no such schema: %s", zDbase);
return pCursor->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM; return pCursor->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM_BKPT;
} }
}else{ }else{
pCsr->iDb = pTab->iDb; pCsr->iDb = pTab->iDb;
@@ -604,7 +604,7 @@ static int statFilter(
" FROM \"%w\".%s WHERE rootpage!=0" " FROM \"%w\".%s WHERE rootpage!=0"
" ORDER BY name", pTab->db->aDb[pCsr->iDb].zName, zMaster); " ORDER BY name", pTab->db->aDb[pCsr->iDb].zName, zMaster);
if( zSql==0 ){ if( zSql==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
}else{ }else{
rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0); rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
sqlite3_free(zSql); sqlite3_free(zSql);

View File

@@ -212,7 +212,7 @@ int sqlite3JournalOpen(
if( nBuf>0 ){ if( nBuf>0 ){
p->zBuf = sqlite3MallocZero(nBuf); p->zBuf = sqlite3MallocZero(nBuf);
if( !p->zBuf ){ if( !p->zBuf ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
}else{ }else{
return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0); return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0);

View File

@@ -131,7 +131,7 @@ exec_out:
if( *pzErrMsg ){ if( *pzErrMsg ){
memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg); memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);
}else{ }else{
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
sqlite3Error(db, SQLITE_NOMEM); sqlite3Error(db, SQLITE_NOMEM);
} }
}else if( pzErrMsg ){ }else if( pzErrMsg ){

View File

@@ -478,7 +478,7 @@ static int sqlite3LoadExtension(
#if SQLITE_OS_UNIX || SQLITE_OS_WIN #if SQLITE_OS_UNIX || SQLITE_OS_WIN
for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){ for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]); char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
if( zAltFile==0 ) return SQLITE_NOMEM; if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
handle = sqlite3OsDlOpen(pVfs, zAltFile); handle = sqlite3OsDlOpen(pVfs, zAltFile);
sqlite3_free(zAltFile); sqlite3_free(zAltFile);
} }
@@ -514,7 +514,7 @@ static int sqlite3LoadExtension(
zAltEntry = sqlite3_malloc64(ncFile+30); zAltEntry = sqlite3_malloc64(ncFile+30);
if( zAltEntry==0 ){ if( zAltEntry==0 ){
sqlite3OsDlClose(pVfs, handle); sqlite3OsDlClose(pVfs, handle);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memcpy(zAltEntry, "sqlite3_", 8); memcpy(zAltEntry, "sqlite3_", 8);
for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){} for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){}
@@ -557,7 +557,7 @@ static int sqlite3LoadExtension(
/* Append the new shared library handle to the db->aExtension array. */ /* Append the new shared library handle to the db->aExtension array. */
aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1)); aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1));
if( aHandle==0 ){ if( aHandle==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
if( db->nExtension>0 ){ if( db->nExtension>0 ){
memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension); memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension);
@@ -679,7 +679,7 @@ int sqlite3_auto_extension(void (*xInit)(void)){
void (**aNew)(void); void (**aNew)(void);
aNew = sqlite3_realloc64(wsdAutoext.aExt, nByte); aNew = sqlite3_realloc64(wsdAutoext.aExt, nByte);
if( aNew==0 ){ if( aNew==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
wsdAutoext.aExt = aNew; wsdAutoext.aExt = aNew;
wsdAutoext.aExt[wsdAutoext.nExt] = xInit; wsdAutoext.aExt[wsdAutoext.nExt] = xInit;

View File

@@ -187,7 +187,7 @@ int sqlite3_initialize(void){
sqlite3GlobalConfig.pInitMutex = sqlite3GlobalConfig.pInitMutex =
sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){ if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
} }
} }
@@ -1643,7 +1643,7 @@ int sqlite3CreateFunc(
p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 1); p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 1);
assert(p || db->mallocFailed); assert(p || db->mallocFailed);
if( !p ){ if( !p ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
/* If an older version of the function with a configured destructor is /* If an older version of the function with a configured destructor is
@@ -2146,14 +2146,14 @@ int sqlite3TempInMemory(const sqlite3 *db){
const char *sqlite3_errmsg(sqlite3 *db){ const char *sqlite3_errmsg(sqlite3 *db){
const char *z; const char *z;
if( !db ){ if( !db ){
return sqlite3ErrStr(SQLITE_NOMEM); return sqlite3ErrStr(SQLITE_NOMEM_BKPT);
} }
if( !sqlite3SafetyCheckSickOrOk(db) ){ if( !sqlite3SafetyCheckSickOrOk(db) ){
return sqlite3ErrStr(SQLITE_MISUSE_BKPT); return sqlite3ErrStr(SQLITE_MISUSE_BKPT);
} }
sqlite3_mutex_enter(db->mutex); sqlite3_mutex_enter(db->mutex);
if( db->mallocFailed ){ if( db->mallocFailed ){
z = sqlite3ErrStr(SQLITE_NOMEM); z = sqlite3ErrStr(SQLITE_NOMEM_BKPT);
}else{ }else{
testcase( db->pErr==0 ); testcase( db->pErr==0 );
z = (char*)sqlite3_value_text(db->pErr); z = (char*)sqlite3_value_text(db->pErr);
@@ -2221,7 +2221,7 @@ int sqlite3_errcode(sqlite3 *db){
return SQLITE_MISUSE_BKPT; return SQLITE_MISUSE_BKPT;
} }
if( !db || db->mallocFailed ){ if( !db || db->mallocFailed ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
return db->errCode & db->errMask; return db->errCode & db->errMask;
} }
@@ -2230,7 +2230,7 @@ int sqlite3_extended_errcode(sqlite3 *db){
return SQLITE_MISUSE_BKPT; return SQLITE_MISUSE_BKPT;
} }
if( !db || db->mallocFailed ){ if( !db || db->mallocFailed ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
return db->errCode; return db->errCode;
} }
@@ -2310,7 +2310,7 @@ static int createCollation(
} }
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1); pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1);
if( pColl==0 ) return SQLITE_NOMEM; if( pColl==0 ) return SQLITE_NOMEM_BKPT;
pColl->xCmp = xCompare; pColl->xCmp = xCompare;
pColl->pUser = pCtx; pColl->pUser = pCtx;
pColl->xDel = xDel; pColl->xDel = xDel;
@@ -2489,7 +2489,7 @@ int sqlite3ParseUri(
for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&'); for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&');
zFile = sqlite3_malloc64(nByte); zFile = sqlite3_malloc64(nByte);
if( !zFile ) return SQLITE_NOMEM; if( !zFile ) return SQLITE_NOMEM_BKPT;
iIn = 5; iIn = 5;
#ifdef SQLITE_ALLOW_URI_AUTHORITY #ifdef SQLITE_ALLOW_URI_AUTHORITY
@@ -2655,7 +2655,7 @@ int sqlite3ParseUri(
}else{ }else{
zFile = sqlite3_malloc64(nUri+2); zFile = sqlite3_malloc64(nUri+2);
if( !zFile ) return SQLITE_NOMEM; if( !zFile ) return SQLITE_NOMEM_BKPT;
memcpy(zFile, zUri, nUri); memcpy(zFile, zUri, nUri);
zFile[nUri] = '\0'; zFile[nUri] = '\0';
zFile[nUri+1] = '\0'; zFile[nUri+1] = '\0';
@@ -2854,7 +2854,7 @@ static int openDatabase(
flags | SQLITE_OPEN_MAIN_DB); flags | SQLITE_OPEN_MAIN_DB);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
if( rc==SQLITE_IOERR_NOMEM ){ if( rc==SQLITE_IOERR_NOMEM ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
sqlite3Error(db, rc); sqlite3Error(db, rc);
goto opendb_out; goto opendb_out;
@@ -3057,7 +3057,7 @@ int sqlite3_open16(
SCHEMA_ENC(*ppDb) = ENC(*ppDb) = SQLITE_UTF16NATIVE; SCHEMA_ENC(*ppDb) = ENC(*ppDb) = SQLITE_UTF16NATIVE;
} }
}else{ }else{
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
sqlite3ValueFree(pVal); sqlite3ValueFree(pVal);
@@ -3202,7 +3202,7 @@ int sqlite3_get_autocommit(sqlite3 *db){
/* /*
** The following routines are substitutes for constants SQLITE_CORRUPT, ** The following routines are substitutes for constants SQLITE_CORRUPT,
** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_IOERR and possibly other error ** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_NOMEM and possibly other error
** constants. They serve two purposes: ** constants. They serve two purposes:
** **
** 1. Serve as a convenient place to set a breakpoint in a debugger ** 1. Serve as a convenient place to set a breakpoint in a debugger
@@ -3211,28 +3211,33 @@ int sqlite3_get_autocommit(sqlite3 *db){
** 2. Invoke sqlite3_log() to provide the source code location where ** 2. Invoke sqlite3_log() to provide the source code location where
** a low-level error is first detected. ** a low-level error is first detected.
*/ */
static int reportError(int iErr, int lineno, const char *zType){
sqlite3_log(iErr, "%s at line %d of [%.10s]",
zType, lineno, 20+sqlite3_sourceid());
return iErr;
}
int sqlite3CorruptError(int lineno){ int sqlite3CorruptError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 ); testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_CORRUPT, return reportError(SQLITE_CORRUPT, lineno, "database corruption");
"database corruption at line %d of [%.10s]",
lineno, 20+sqlite3_sourceid());
return SQLITE_CORRUPT;
} }
int sqlite3MisuseError(int lineno){ int sqlite3MisuseError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 ); testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_MISUSE, return reportError(SQLITE_MISUSE, lineno, "misuse");
"misuse at line %d of [%.10s]",
lineno, 20+sqlite3_sourceid());
return SQLITE_MISUSE;
} }
int sqlite3CantopenError(int lineno){ int sqlite3CantopenError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 ); testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_CANTOPEN, return reportError(SQLITE_CANTOPEN, lineno, "cannot open file");
"cannot open file at line %d of [%.10s]",
lineno, 20+sqlite3_sourceid());
return SQLITE_CANTOPEN;
} }
#ifdef SQLITE_DEBUG
int sqlite3NomemError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
return reportError(SQLITE_NOMEM, lineno, "OOM");
}
int sqlite3IoerrnomemError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
return reportError(SQLITE_IOERR_NOMEM, lineno, "I/O OOM error");
}
#endif
#ifndef SQLITE_OMIT_DEPRECATED #ifndef SQLITE_OMIT_DEPRECATED
/* /*

View File

@@ -795,7 +795,7 @@ void sqlite3OomClear(sqlite3 *db){
static SQLITE_NOINLINE int apiOomError(sqlite3 *db){ static SQLITE_NOINLINE int apiOomError(sqlite3 *db){
sqlite3OomClear(db); sqlite3OomClear(db);
sqlite3Error(db, SQLITE_NOMEM); sqlite3Error(db, SQLITE_NOMEM);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
/* /*

View File

@@ -133,7 +133,7 @@ static int memjrnlWrite(
/* New chunk is required to extend the file. */ /* New chunk is required to extend the file. */
FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk)); FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk));
if( !pNew ){ if( !pNew ){
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
pNew->pNext = 0; pNew->pNext = 0;
if( pChunk ){ if( pChunk ){

View File

@@ -68,7 +68,7 @@ int sqlite3_memdebug_vfs_oom_test = 1;
#define DO_OS_MALLOC_TEST(x) \ #define DO_OS_MALLOC_TEST(x) \
if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) { \ if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) { \
void *pTstAlloc = sqlite3Malloc(10); \ void *pTstAlloc = sqlite3Malloc(10); \
if (!pTstAlloc) return SQLITE_IOERR_NOMEM; \ if (!pTstAlloc) return SQLITE_IOERR_NOMEM_BKPT; \
sqlite3_free(pTstAlloc); \ sqlite3_free(pTstAlloc); \
} }
#else #else
@@ -287,7 +287,7 @@ int sqlite3OsOpenMalloc(
int flags, int flags,
int *pOutFlags int *pOutFlags
){ ){
int rc = SQLITE_NOMEM; int rc;
sqlite3_file *pFile; sqlite3_file *pFile;
pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile); pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);
if( pFile ){ if( pFile ){
@@ -297,6 +297,8 @@ int sqlite3OsOpenMalloc(
}else{ }else{
*ppFile = pFile; *ppFile = pFile;
} }
}else{
rc = SQLITE_NOMEM_BKPT;
} }
return rc; return rc;
} }
@@ -316,7 +318,7 @@ int sqlite3OsCloseFree(sqlite3_file *pFile){
*/ */
int sqlite3OsInit(void){ int sqlite3OsInit(void){
void *p = sqlite3_malloc(10); void *p = sqlite3_malloc(10);
if( p==0 ) return SQLITE_NOMEM; if( p==0 ) return SQLITE_NOMEM_BKPT;
sqlite3_free(p); sqlite3_free(p);
return sqlite3_os_init(); return sqlite3_os_init();
} }

View File

@@ -1302,7 +1302,7 @@ static int findInodeInfo(
if( pInode==0 ){ if( pInode==0 ){
pInode = sqlite3_malloc64( sizeof(*pInode) ); pInode = sqlite3_malloc64( sizeof(*pInode) );
if( pInode==0 ){ if( pInode==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memset(pInode, 0, sizeof(*pInode)); memset(pInode, 0, sizeof(*pInode));
memcpy(&pInode->fileId, &fileId, sizeof(fileId)); memcpy(&pInode->fileId, &fileId, sizeof(fileId));
@@ -4222,7 +4222,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
/* Allocate space for the new unixShm object. */ /* Allocate space for the new unixShm object. */
p = sqlite3_malloc64( sizeof(*p) ); p = sqlite3_malloc64( sizeof(*p) );
if( p==0 ) return SQLITE_NOMEM; if( p==0 ) return SQLITE_NOMEM_BKPT;
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
assert( pDbFd->pShm==0 ); assert( pDbFd->pShm==0 );
@@ -4254,7 +4254,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
#endif #endif
pShmNode = sqlite3_malloc64( sizeof(*pShmNode) + nShmFilename ); pShmNode = sqlite3_malloc64( sizeof(*pShmNode) + nShmFilename );
if( pShmNode==0 ){ if( pShmNode==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto shm_open_err; goto shm_open_err;
} }
memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename); memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename);
@@ -4272,7 +4272,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
pShmNode->pInode = pDbFd->pInode; pShmNode->pInode = pDbFd->pInode;
pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
if( pShmNode->mutex==0 ){ if( pShmNode->mutex==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto shm_open_err; goto shm_open_err;
} }
@@ -4445,7 +4445,7 @@ static int unixShmMap(
pShmNode->apRegion, nReqRegion*sizeof(char *) pShmNode->apRegion, nReqRegion*sizeof(char *)
); );
if( !apNew ){ if( !apNew ){
rc = SQLITE_IOERR_NOMEM; rc = SQLITE_IOERR_NOMEM_BKPT;
goto shmpage_out; goto shmpage_out;
} }
pShmNode->apRegion = apNew; pShmNode->apRegion = apNew;
@@ -4465,7 +4465,7 @@ static int unixShmMap(
}else{ }else{
pMem = sqlite3_malloc64(szRegion); pMem = sqlite3_malloc64(szRegion);
if( pMem==0 ){ if( pMem==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto shmpage_out; goto shmpage_out;
} }
memset(pMem, 0, szRegion); memset(pMem, 0, szRegion);
@@ -5243,7 +5243,7 @@ static int fillInUnixFile(
pNew->pId = vxworksFindFileId(zFilename); pNew->pId = vxworksFindFileId(zFilename);
if( pNew->pId==0 ){ if( pNew->pId==0 ){
ctrlFlags |= UNIXFILE_NOLOCK; ctrlFlags |= UNIXFILE_NOLOCK;
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
#endif #endif
@@ -5299,7 +5299,7 @@ static int fillInUnixFile(
afpLockingContext *pCtx; afpLockingContext *pCtx;
pNew->lockingContext = pCtx = sqlite3_malloc64( sizeof(*pCtx) ); pNew->lockingContext = pCtx = sqlite3_malloc64( sizeof(*pCtx) );
if( pCtx==0 ){ if( pCtx==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
/* NB: zFilename exists and remains valid until the file is closed /* NB: zFilename exists and remains valid until the file is closed
** according to requirement F11141. So we do not need to make a ** according to requirement F11141. So we do not need to make a
@@ -5329,7 +5329,7 @@ static int fillInUnixFile(
nFilename = (int)strlen(zFilename) + 6; nFilename = (int)strlen(zFilename) + 6;
zLockFile = (char *)sqlite3_malloc64(nFilename); zLockFile = (char *)sqlite3_malloc64(nFilename);
if( zLockFile==0 ){ if( zLockFile==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
sqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename); sqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename);
} }
@@ -5352,7 +5352,7 @@ static int fillInUnixFile(
if( zSemName[n]=='/' ) zSemName[n] = '_'; if( zSemName[n]=='/' ) zSemName[n] = '_';
pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1); pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1);
if( pNew->pInode->pSem == SEM_FAILED ){ if( pNew->pInode->pSem == SEM_FAILED ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
pNew->pInode->aSemName[0] = '\0'; pNew->pInode->aSemName[0] = '\0';
} }
} }
@@ -5693,7 +5693,7 @@ static int unixOpen(
}else{ }else{
pUnused = sqlite3_malloc64(sizeof(*pUnused)); pUnused = sqlite3_malloc64(sizeof(*pUnused));
if( !pUnused ){ if( !pUnused ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
} }
p->pUnused = pUnused; p->pUnused = pUnused;
@@ -5779,7 +5779,7 @@ static int unixOpen(
zPath = sqlite3_mprintf("%s", zName); zPath = sqlite3_mprintf("%s", zName);
if( zPath==0 ){ if( zPath==0 ){
robust_close(p, fd, __LINE__); robust_close(p, fd, __LINE__);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
#else #else
osUnlink(zName); osUnlink(zName);
@@ -6011,7 +6011,7 @@ static int unixFullPathname(
if( bLink ){ if( bLink ){
if( zDel==0 ){ if( zDel==0 ){
zDel = sqlite3_malloc(nOut); zDel = sqlite3_malloc(nOut);
if( zDel==0 ) rc = SQLITE_NOMEM; if( zDel==0 ) rc = SQLITE_NOMEM_BKPT;
}else if( ++nLink>SQLITE_MAX_SYMLINKS ){ }else if( ++nLink>SQLITE_MAX_SYMLINKS ){
rc = SQLITE_CANTOPEN_BKPT; rc = SQLITE_CANTOPEN_BKPT;
} }
@@ -6555,7 +6555,7 @@ static int proxyCreateUnixFile(
}else{ }else{
pUnused = sqlite3_malloc64(sizeof(*pUnused)); pUnused = sqlite3_malloc64(sizeof(*pUnused));
if( !pUnused ){ if( !pUnused ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
} }
if( fd<0 ){ if( fd<0 ){
@@ -6588,7 +6588,7 @@ static int proxyCreateUnixFile(
pNew = (unixFile *)sqlite3_malloc64(sizeof(*pNew)); pNew = (unixFile *)sqlite3_malloc64(sizeof(*pNew));
if( pNew==NULL ){ if( pNew==NULL ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto end_create_proxy; goto end_create_proxy;
} }
memset(pNew, 0, sizeof(unixFile)); memset(pNew, 0, sizeof(unixFile));
@@ -7001,7 +7001,7 @@ static int proxyTakeConch(unixFile *pFile){
if( tempLockPath ){ if( tempLockPath ){
pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath); pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath);
if( !pCtx->lockProxyPath ){ if( !pCtx->lockProxyPath ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
} }
} }
@@ -7066,7 +7066,7 @@ static int proxyCreateConchPathname(char *dbPath, char **pConchPath){
** the name of the original database file. */ ** the name of the original database file. */
*pConchPath = conchPath = (char *)sqlite3_malloc64(len + 8); *pConchPath = conchPath = (char *)sqlite3_malloc64(len + 8);
if( conchPath==0 ){ if( conchPath==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memcpy(conchPath, dbPath, len+1); memcpy(conchPath, dbPath, len+1);
@@ -7182,7 +7182,7 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
pCtx = sqlite3_malloc64( sizeof(*pCtx) ); pCtx = sqlite3_malloc64( sizeof(*pCtx) );
if( pCtx==0 ){ if( pCtx==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memset(pCtx, 0, sizeof(*pCtx)); memset(pCtx, 0, sizeof(*pCtx));
@@ -7218,7 +7218,7 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
pCtx->dbPath = sqlite3DbStrDup(0, dbPath); pCtx->dbPath = sqlite3DbStrDup(0, dbPath);
if( pCtx->dbPath==NULL ){ if( pCtx->dbPath==NULL ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){

View File

@@ -1222,7 +1222,7 @@ int sqlite3_win32_compact_heap(LPUINT pnLargest){
if( lastErrno==NO_ERROR ){ if( lastErrno==NO_ERROR ){
sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p", sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p",
(void*)hHeap); (void*)hHeap);
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
sqlite3_log(SQLITE_ERROR, "failed to HeapCompact (%lu), heap=%p", sqlite3_log(SQLITE_ERROR, "failed to HeapCompact (%lu), heap=%p",
osGetLastError(), (void*)hHeap); osGetLastError(), (void*)hHeap);
@@ -1542,7 +1542,7 @@ static int winMemInit(void *pAppData){
"failed to HeapCreate (%lu), flags=%u, initSize=%lu, maxSize=%lu", "failed to HeapCreate (%lu), flags=%u, initSize=%lu, maxSize=%lu",
osGetLastError(), SQLITE_WIN32_HEAP_FLAGS, dwInitialSize, osGetLastError(), SQLITE_WIN32_HEAP_FLAGS, dwInitialSize,
dwMaximumSize); dwMaximumSize);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pWinMemData->bOwned = TRUE; pWinMemData->bOwned = TRUE;
assert( pWinMemData->bOwned ); assert( pWinMemData->bOwned );
@@ -1552,7 +1552,7 @@ static int winMemInit(void *pAppData){
if( !pWinMemData->hHeap ){ if( !pWinMemData->hHeap ){
sqlite3_log(SQLITE_NOMEM, sqlite3_log(SQLITE_NOMEM,
"failed to GetProcessHeap (%lu)", osGetLastError()); "failed to GetProcessHeap (%lu)", osGetLastError());
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pWinMemData->bOwned = FALSE; pWinMemData->bOwned = FALSE;
assert( !pWinMemData->bOwned ); assert( !pWinMemData->bOwned );
@@ -1789,7 +1789,7 @@ int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){
if( zValue && zValue[0] ){ if( zValue && zValue[0] ){
zValueUtf8 = winUnicodeToUtf8(zValue); zValueUtf8 = winUnicodeToUtf8(zValue);
if ( zValueUtf8==0 ){ if ( zValueUtf8==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
} }
sqlite3_free(*ppDirectory); sqlite3_free(*ppDirectory);
@@ -2066,7 +2066,7 @@ static int winceCreateLock(const char *zFilename, winFile *pFile){
zName = winUtf8ToUnicode(zFilename); zName = winUtf8ToUnicode(zFilename);
if( zName==0 ){ if( zName==0 ){
/* out of memory */ /* out of memory */
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
/* Initialize the local lockdata */ /* Initialize the local lockdata */
@@ -3615,12 +3615,12 @@ static int winOpenSharedMemory(winFile *pDbFd){
** allocate space for a new winShmNode and filename. ** allocate space for a new winShmNode and filename.
*/ */
p = sqlite3MallocZero( sizeof(*p) ); p = sqlite3MallocZero( sizeof(*p) );
if( p==0 ) return SQLITE_IOERR_NOMEM; if( p==0 ) return SQLITE_IOERR_NOMEM_BKPT;
nName = sqlite3Strlen30(pDbFd->zPath); nName = sqlite3Strlen30(pDbFd->zPath);
pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 );
if( pNew==0 ){ if( pNew==0 ){
sqlite3_free(p); sqlite3_free(p);
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
pNew->zFilename = (char*)&pNew[1]; pNew->zFilename = (char*)&pNew[1];
sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath); sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath);
@@ -3647,7 +3647,7 @@ static int winOpenSharedMemory(winFile *pDbFd){
pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
if( pShmNode->mutex==0 ){ if( pShmNode->mutex==0 ){
rc = SQLITE_IOERR_NOMEM; rc = SQLITE_IOERR_NOMEM_BKPT;
goto shm_open_err; goto shm_open_err;
} }
@@ -3952,7 +3952,7 @@ static int winShmMap(
pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0]) pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0])
); );
if( !apNew ){ if( !apNew ){
rc = SQLITE_IOERR_NOMEM; rc = SQLITE_IOERR_NOMEM_BKPT;
goto shmpage_out; goto shmpage_out;
} }
pShmNode->aRegion = apNew; pShmNode->aRegion = apNew;
@@ -4382,7 +4382,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
zBuf = sqlite3MallocZero( nBuf ); zBuf = sqlite3MallocZero( nBuf );
if( !zBuf ){ if( !zBuf ){
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
/* Figure out the effective temporary directory. First, check if one /* Figure out the effective temporary directory. First, check if one
@@ -4440,7 +4440,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
if( !zConverted ){ if( !zConverted ){
sqlite3_free(zBuf); sqlite3_free(zBuf);
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( winIsDir(zConverted) ){ if( winIsDir(zConverted) ){
sqlite3_snprintf(nMax, zBuf, "%s", zDir); sqlite3_snprintf(nMax, zBuf, "%s", zDir);
@@ -4453,7 +4453,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
if( !zConverted ){ if( !zConverted ){
sqlite3_free(zBuf); sqlite3_free(zBuf);
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( cygwin_conv_path( if( cygwin_conv_path(
osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir, osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir,
@@ -4474,7 +4474,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
sqlite3_free(zConverted); sqlite3_free(zConverted);
sqlite3_free(zBuf); sqlite3_free(zBuf);
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
sqlite3_snprintf(nMax, zBuf, "%s", zUtf8); sqlite3_snprintf(nMax, zBuf, "%s", zUtf8);
sqlite3_free(zUtf8); sqlite3_free(zUtf8);
@@ -4492,7 +4492,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
if( !zWidePath ){ if( !zWidePath ){
sqlite3_free(zBuf); sqlite3_free(zBuf);
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( osGetTempPathW(nMax, zWidePath)==0 ){ if( osGetTempPathW(nMax, zWidePath)==0 ){
sqlite3_free(zWidePath); sqlite3_free(zWidePath);
@@ -4510,7 +4510,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
sqlite3_free(zWidePath); sqlite3_free(zWidePath);
sqlite3_free(zBuf); sqlite3_free(zBuf);
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
} }
#ifdef SQLITE_WIN32_HAS_ANSI #ifdef SQLITE_WIN32_HAS_ANSI
@@ -4520,7 +4520,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
if( !zMbcsPath ){ if( !zMbcsPath ){
sqlite3_free(zBuf); sqlite3_free(zBuf);
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( osGetTempPathA(nMax, zMbcsPath)==0 ){ if( osGetTempPathA(nMax, zMbcsPath)==0 ){
sqlite3_free(zBuf); sqlite3_free(zBuf);
@@ -4535,7 +4535,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
}else{ }else{
sqlite3_free(zBuf); sqlite3_free(zBuf);
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
} }
#endif /* SQLITE_WIN32_HAS_ANSI */ #endif /* SQLITE_WIN32_HAS_ANSI */
@@ -4727,7 +4727,7 @@ static int winOpen(
if( zConverted==0 ){ if( zConverted==0 ){
sqlite3_free(zTmpname); sqlite3_free(zTmpname);
OSTRACE(("OPEN name=%s, rc=SQLITE_IOERR_NOMEM", zUtf8Name)); OSTRACE(("OPEN name=%s, rc=SQLITE_IOERR_NOMEM", zUtf8Name));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( winIsDir(zConverted) ){ if( winIsDir(zConverted) ){
@@ -4927,7 +4927,7 @@ static int winDelete(
zConverted = winConvertFromUtf8Filename(zFilename); zConverted = winConvertFromUtf8Filename(zFilename);
if( zConverted==0 ){ if( zConverted==0 ){
OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename)); OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( osIsNT() ){ if( osIsNT() ){
do { do {
@@ -5035,7 +5035,7 @@ static int winAccess(
zConverted = winConvertFromUtf8Filename(zFilename); zConverted = winConvertFromUtf8Filename(zFilename);
if( zConverted==0 ){ if( zConverted==0 ){
OSTRACE(("ACCESS name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename)); OSTRACE(("ACCESS name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( osIsNT() ){ if( osIsNT() ){
int cnt = 0; int cnt = 0;
@@ -5162,7 +5162,7 @@ static int winFullPathname(
*/ */
char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
if( !zOut ){ if( !zOut ){
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( cygwin_conv_path( if( cygwin_conv_path(
(osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) | (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) |
@@ -5174,7 +5174,7 @@ static int winFullPathname(
char *zUtf8 = winConvertToUtf8Filename(zOut); char *zUtf8 = winConvertToUtf8Filename(zOut);
if( !zUtf8 ){ if( !zUtf8 ){
sqlite3_free(zOut); sqlite3_free(zOut);
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
sqlite3_data_directory, winGetDirSep(), zUtf8); sqlite3_data_directory, winGetDirSep(), zUtf8);
@@ -5184,7 +5184,7 @@ static int winFullPathname(
}else{ }else{
char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
if( !zOut ){ if( !zOut ){
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( cygwin_conv_path( if( cygwin_conv_path(
(osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A), (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A),
@@ -5196,7 +5196,7 @@ static int winFullPathname(
char *zUtf8 = winConvertToUtf8Filename(zOut); char *zUtf8 = winConvertToUtf8Filename(zOut);
if( !zUtf8 ){ if( !zUtf8 ){
sqlite3_free(zOut); sqlite3_free(zOut);
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8); sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8);
sqlite3_free(zUtf8); sqlite3_free(zUtf8);
@@ -5256,7 +5256,7 @@ static int winFullPathname(
} }
zConverted = winConvertFromUtf8Filename(zRelative); zConverted = winConvertFromUtf8Filename(zRelative);
if( zConverted==0 ){ if( zConverted==0 ){
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
if( osIsNT() ){ if( osIsNT() ){
LPWSTR zTemp; LPWSTR zTemp;
@@ -5270,7 +5270,7 @@ static int winFullPathname(
zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
if( zTemp==0 ){ if( zTemp==0 ){
sqlite3_free(zConverted); sqlite3_free(zConverted);
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0);
if( nByte==0 ){ if( nByte==0 ){
@@ -5296,7 +5296,7 @@ static int winFullPathname(
zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
if( zTemp==0 ){ if( zTemp==0 ){
sqlite3_free(zConverted); sqlite3_free(zConverted);
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0);
if( nByte==0 ){ if( nByte==0 ){
@@ -5315,7 +5315,7 @@ static int winFullPathname(
sqlite3_free(zOut); sqlite3_free(zOut);
return SQLITE_OK; return SQLITE_OK;
}else{ }else{
return SQLITE_IOERR_NOMEM; return SQLITE_IOERR_NOMEM_BKPT;
} }
#endif #endif
} }

View File

@@ -2324,9 +2324,9 @@ static int pager_playback_one_page(
pPager->dbFileSize = pgno; pPager->dbFileSize = pgno;
} }
if( pPager->pBackup ){ if( pPager->pBackup ){
CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM); CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData); sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM, aData); CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData);
} }
}else if( !isMainJrnl && pPg==0 ){ }else if( !isMainJrnl && pPg==0 ){
/* If this is a rollback of a savepoint and data was not written to /* If this is a rollback of a savepoint and data was not written to
@@ -2398,7 +2398,7 @@ static int pager_playback_one_page(
} }
/* Decode the page just read from disk */ /* Decode the page just read from disk */
CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM); CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT);
sqlite3PcacheRelease(pPg); sqlite3PcacheRelease(pPg);
} }
return rc; return rc;
@@ -2464,7 +2464,7 @@ static int pager_delmaster(Pager *pPager, const char *zMaster){
pMaster = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2); pMaster = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2);
pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile); pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile);
if( !pMaster ){ if( !pMaster ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL); const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL);
rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0); rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0);
@@ -2481,7 +2481,7 @@ static int pager_delmaster(Pager *pPager, const char *zMaster){
nMasterPtr = pVfs->mxPathname+1; nMasterPtr = pVfs->mxPathname+1;
zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 1); zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 1);
if( !zMasterJournal ){ if( !zMasterJournal ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto delmaster_out; goto delmaster_out;
} }
zMasterPtr = &zMasterJournal[nMasterJournal+1]; zMasterPtr = &zMasterJournal[nMasterJournal+1];
@@ -2951,7 +2951,7 @@ static int readDbPage(PgHdr *pPg, u32 iFrame){
memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers)); memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
} }
} }
CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM); CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM_BKPT);
PAGER_INCR(sqlite3_pager_readdb_count); PAGER_INCR(sqlite3_pager_readdb_count);
PAGER_INCR(pPager->nRead); PAGER_INCR(pPager->nRead);
@@ -3311,7 +3311,7 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
if( pSavepoint ){ if( pSavepoint ){
pDone = sqlite3BitvecCreate(pSavepoint->nOrig); pDone = sqlite3BitvecCreate(pSavepoint->nOrig);
if( !pDone ){ if( !pDone ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
} }
@@ -3674,7 +3674,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
pNew = (char *)sqlite3PageMalloc(pageSize); pNew = (char *)sqlite3PageMalloc(pageSize);
if( !pNew ) rc = SQLITE_NOMEM; if( !pNew ) rc = SQLITE_NOMEM_BKPT;
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
@@ -3950,7 +3950,7 @@ static int pagerAcquireMapPage(
*ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra); *ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra);
if( p==0 ){ if( p==0 ){
sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData); sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
p->pExtra = (void *)&p[1]; p->pExtra = (void *)&p[1];
p->flags = PGHDR_MMAP; p->flags = PGHDR_MMAP;
@@ -4308,7 +4308,7 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
if( pList->pgno==1 ) pager_write_changecounter(pList); if( pList->pgno==1 ) pager_write_changecounter(pList);
/* Encode the database */ /* Encode the database */
CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData); CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM_BKPT, pData);
/* Write out the page data. */ /* Write out the page data. */
rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset); rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);
@@ -4395,7 +4395,7 @@ static int subjournalPage(PgHdr *pPg){
i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize); i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
char *pData2; char *pData2;
CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno)); PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
rc = write32bits(pPager->sjfd, offset, pPg->pgno); rc = write32bits(pPager->sjfd, offset, pPg->pgno);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
@@ -4599,7 +4599,7 @@ int sqlite3PagerOpen(
memDb = 1; memDb = 1;
if( zFilename && zFilename[0] ){ if( zFilename && zFilename[0] ){
zPathname = sqlite3DbStrDup(0, zFilename); zPathname = sqlite3DbStrDup(0, zFilename);
if( zPathname==0 ) return SQLITE_NOMEM; if( zPathname==0 ) return SQLITE_NOMEM_BKPT;
nPathname = sqlite3Strlen30(zPathname); nPathname = sqlite3Strlen30(zPathname);
zFilename = 0; zFilename = 0;
} }
@@ -4615,7 +4615,7 @@ int sqlite3PagerOpen(
nPathname = pVfs->mxPathname+1; nPathname = pVfs->mxPathname+1;
zPathname = sqlite3DbMallocRaw(0, nPathname*2); zPathname = sqlite3DbMallocRaw(0, nPathname*2);
if( zPathname==0 ){ if( zPathname==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */ zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */
rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname); rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);
@@ -4668,7 +4668,7 @@ int sqlite3PagerOpen(
assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) ); assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );
if( !pPtr ){ if( !pPtr ){
sqlite3DbFree(0, zPathname); sqlite3DbFree(0, zPathname);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pPager = (Pager*)(pPtr); pPager = (Pager*)(pPtr);
pPager->pPCache = (PCache*)(pPtr += ROUND8(sizeof(*pPager))); pPager->pPCache = (PCache*)(pPtr += ROUND8(sizeof(*pPager)));
@@ -5388,7 +5388,7 @@ int sqlite3PagerGet(
if( rc!=SQLITE_OK ) goto pager_acquire_err; if( rc!=SQLITE_OK ) goto pager_acquire_err;
if( pBase==0 ){ if( pBase==0 ){
pPg = *ppPage = 0; pPg = *ppPage = 0;
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto pager_acquire_err; goto pager_acquire_err;
} }
} }
@@ -5562,7 +5562,7 @@ static int pager_open_journal(Pager *pPager){
if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){ if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize); pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize);
if( pPager->pInJournal==0 ){ if( pPager->pInJournal==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
/* Open the journal file if it is not already open. */ /* Open the journal file if it is not already open. */
@@ -5717,7 +5717,7 @@ static SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){
assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) ); assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
assert( pPager->journalHdr<=pPager->journalOff ); assert( pPager->journalHdr<=pPager->journalOff );
CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
cksum = pager_cksum(pPager, (u8*)pData2); cksum = pager_cksum(pPager, (u8*)pData2);
/* Even if an IO or diskfull error occurs while journalling the /* Even if an IO or diskfull error occurs while journalling the
@@ -6074,7 +6074,7 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){
if( DIRECT_MODE ){ if( DIRECT_MODE ){
const void *zBuf; const void *zBuf;
assert( pPager->dbFileSize>0 ); assert( pPager->dbFileSize>0 );
CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM, zBuf); CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM_BKPT, zBuf);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0); rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0);
pPager->aStat[PAGER_STAT_WRITE]++; pPager->aStat[PAGER_STAT_WRITE]++;
@@ -6573,7 +6573,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint
); );
if( !aNew ){ if( !aNew ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint)); memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint));
pPager->aSavepoint = aNew; pPager->aSavepoint = aNew;
@@ -6589,7 +6589,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
aNew[ii].iSubRec = pPager->nSubRec; aNew[ii].iSubRec = pPager->nSubRec;
aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize); aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize);
if( !aNew[ii].pInSavepoint ){ if( !aNew[ii].pInSavepoint ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
if( pagerUseWal(pPager) ){ if( pagerUseWal(pPager) ){
sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData); sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData);

View File

@@ -191,7 +191,7 @@ int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)), szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)),
pCache->bPurgeable pCache->bPurgeable
); );
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM_BKPT;
sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache)); sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache));
if( pCache->pCache ){ if( pCache->pCache ){
sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache); sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);
@@ -301,7 +301,7 @@ int sqlite3PcacheFetchStress(
} }
} }
*ppPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2); *ppPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2);
return *ppPage==0 ? SQLITE_NOMEM : SQLITE_OK; return *ppPage==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;
} }
/* /*

View File

@@ -33,7 +33,7 @@ static void corruptSchema(
sqlite3DbFree(db, *pData->pzErrMsg); sqlite3DbFree(db, *pData->pzErrMsg);
*pData->pzErrMsg = z; *pData->pzErrMsg = z;
} }
pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT; pData->rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_CORRUPT_BKPT;
} }
/* /*
@@ -307,7 +307,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
#endif #endif
} }
if( db->mallocFailed ){ if( db->mallocFailed ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
sqlite3ResetAllSchemasOfConnection(db); sqlite3ResetAllSchemasOfConnection(db);
} }
if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){ if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){
@@ -524,7 +524,7 @@ static int sqlite3Prepare(
/* Allocate the parsing context */ /* Allocate the parsing context */
pParse = sqlite3StackAllocZero(db, sizeof(*pParse)); pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
if( pParse==0 ){ if( pParse==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto end_prepare; goto end_prepare;
} }
pParse->pReprepare = pReprepare; pParse->pReprepare = pReprepare;
@@ -601,7 +601,7 @@ static int sqlite3Prepare(
schemaIsValid(pParse); schemaIsValid(pParse);
} }
if( db->mallocFailed ){ if( db->mallocFailed ){
pParse->rc = SQLITE_NOMEM; pParse->rc = SQLITE_NOMEM_BKPT;
} }
if( pzTail ){ if( pzTail ){
*pzTail = pParse->zTail; *pzTail = pParse->zTail;

View File

@@ -1688,7 +1688,7 @@ int sqlite3ColumnsFromExprList(
sqlite3DbFree(db, aCol); sqlite3DbFree(db, aCol);
*paCol = 0; *paCol = 0;
*pnCol = 0; *pnCol = 0;
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
return SQLITE_OK; return SQLITE_OK;
} }
@@ -2499,7 +2499,7 @@ static int multiSelect(
nCol = p->pEList->nExpr; nCol = p->pEList->nExpr;
pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1); pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1);
if( !pKeyInfo ){ if( !pKeyInfo ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto multi_select_end; goto multi_select_end;
} }
for(i=0, apColl=pKeyInfo->aColl; i<nCol; i++, apColl++){ for(i=0, apColl=pKeyInfo->aColl; i<nCol; i++, apColl++){
@@ -2854,7 +2854,7 @@ static int multiSelectOrderBy(
} }
if( j==nOrderBy ){ if( j==nOrderBy ){
Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0); Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM_BKPT;
pNew->flags |= EP_IntValue; pNew->flags |= EP_IntValue;
pNew->u.iValue = i; pNew->u.iValue = i;
pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew); pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
@@ -4091,7 +4091,7 @@ static int withExpand(
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid; pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0); pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);
if( db->mallocFailed ) return SQLITE_NOMEM; if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
assert( pFrom->pSelect ); assert( pFrom->pSelect );
/* Check if this is a recursive CTE. */ /* Check if this is a recursive CTE. */

View File

@@ -3177,6 +3177,15 @@ int sqlite3CantopenError(int);
#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__) #define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__)
#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__) #define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__)
#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__) #define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__)
#ifdef SQLITE_DEBUG
int sqlite3NomemError(int);
int sqlite3IoerrnomemError(int);
# define SQLITE_NOMEM_BKPT sqlite3NomemError(__LINE__)
# define SQLITE_IOERR_NOMEM_BKPT sqlite3IoerrnomemError(__LINE__)
#else
# define SQLITE_NOMEM_BKPT SQLITE_NOMEM
# define SQLITE_IOERR_NOMEM_BKPT SQLITE_IOERR_NOMEM
#endif
/* /*
** FTS3 and FTS4 both require virtual table support ** FTS3 and FTS4 both require virtual table support

View File

@@ -101,7 +101,7 @@ static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
return 0; return 0;
malloc_failed: malloc_failed:
p->rc = SQLITE_NOMEM; p->rc = SQLITE_NOMEM_BKPT;
return 1; return 1;
} }
@@ -142,7 +142,7 @@ int sqlite3_get_table(
res.azResult = sqlite3_malloc64(sizeof(char*)*res.nAlloc ); res.azResult = sqlite3_malloc64(sizeof(char*)*res.nAlloc );
if( res.azResult==0 ){ if( res.azResult==0 ){
db->errCode = SQLITE_NOMEM; db->errCode = SQLITE_NOMEM;
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
res.azResult[0] = 0; res.azResult[0] = 0;
rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg); rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
@@ -171,7 +171,7 @@ int sqlite3_get_table(
if( azNew==0 ){ if( azNew==0 ){
sqlite3_free_table(&res.azResult[1]); sqlite3_free_table(&res.azResult[1]);
db->errCode = SQLITE_NOMEM; db->errCode = SQLITE_NOMEM;
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
res.azResult = azNew; res.azResult = azNew;
} }

View File

@@ -63,7 +63,7 @@ int sqlite3ThreadCreate(
*ppThread = 0; *ppThread = 0;
p = sqlite3Malloc(sizeof(*p)); p = sqlite3Malloc(sizeof(*p));
if( p==0 ) return SQLITE_NOMEM; if( p==0 ) return SQLITE_NOMEM_BKPT;
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
p->xTask = xTask; p->xTask = xTask;
p->pIn = pIn; p->pIn = pIn;
@@ -89,7 +89,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
int rc; int rc;
assert( ppOut!=0 ); assert( ppOut!=0 );
if( NEVER(p==0) ) return SQLITE_NOMEM; if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
if( p->done ){ if( p->done ){
*ppOut = p->pOut; *ppOut = p->pOut;
rc = SQLITE_OK; rc = SQLITE_OK;
@@ -154,7 +154,7 @@ int sqlite3ThreadCreate(
assert( xTask!=0 ); assert( xTask!=0 );
*ppThread = 0; *ppThread = 0;
p = sqlite3Malloc(sizeof(*p)); p = sqlite3Malloc(sizeof(*p));
if( p==0 ) return SQLITE_NOMEM; if( p==0 ) return SQLITE_NOMEM_BKPT;
/* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a
** function that returns SQLITE_ERROR when passed the argument 200, that ** function that returns SQLITE_ERROR when passed the argument 200, that
** forces worker threads to run sequentially and deterministically ** forces worker threads to run sequentially and deterministically
@@ -186,7 +186,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
BOOL bRc; BOOL bRc;
assert( ppOut!=0 ); assert( ppOut!=0 );
if( NEVER(p==0) ) return SQLITE_NOMEM; if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
if( p->xTask==0 ){ if( p->xTask==0 ){
/* assert( p->id==GetCurrentThreadId() ); */ /* assert( p->id==GetCurrentThreadId() ); */
rc = WAIT_OBJECT_0; rc = WAIT_OBJECT_0;
@@ -234,7 +234,7 @@ int sqlite3ThreadCreate(
assert( xTask!=0 ); assert( xTask!=0 );
*ppThread = 0; *ppThread = 0;
p = sqlite3Malloc(sizeof(*p)); p = sqlite3Malloc(sizeof(*p));
if( p==0 ) return SQLITE_NOMEM; if( p==0 ) return SQLITE_NOMEM_BKPT;
if( (SQLITE_PTR_TO_INT(p)/17)&1 ){ if( (SQLITE_PTR_TO_INT(p)/17)&1 ){
p->xTask = xTask; p->xTask = xTask;
p->pIn = pIn; p->pIn = pIn;
@@ -250,7 +250,7 @@ int sqlite3ThreadCreate(
int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
assert( ppOut!=0 ); assert( ppOut!=0 );
if( NEVER(p==0) ) return SQLITE_NOMEM; if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
if( p->xTask ){ if( p->xTask ){
*ppOut = p->xTask(p->pIn); *ppOut = p->xTask(p->pIn);
}else{ }else{
@@ -261,7 +261,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
#if defined(SQLITE_TEST) #if defined(SQLITE_TEST)
{ {
void *pTstAlloc = sqlite3Malloc(10); void *pTstAlloc = sqlite3Malloc(10);
if (!pTstAlloc) return SQLITE_NOMEM; if (!pTstAlloc) return SQLITE_NOMEM_BKPT;
sqlite3_free(pTstAlloc); sqlite3_free(pTstAlloc);
} }
#endif #endif

View File

@@ -495,7 +495,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
pEngine = sqlite3ParserAlloc(sqlite3Malloc); pEngine = sqlite3ParserAlloc(sqlite3Malloc);
if( pEngine==0 ){ if( pEngine==0 ){
sqlite3OomFault(db); sqlite3OomFault(db);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
assert( pParse->pNewTable==0 ); assert( pParse->pNewTable==0 );
assert( pParse->pNewTrigger==0 ); assert( pParse->pNewTrigger==0 );
@@ -549,7 +549,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
#endif /* YYDEBUG */ #endif /* YYDEBUG */
sqlite3ParserFree(pEngine, sqlite3_free); sqlite3ParserFree(pEngine, sqlite3_free);
if( db->mallocFailed ){ if( db->mallocFailed ){
pParse->rc = SQLITE_NOMEM; pParse->rc = SQLITE_NOMEM_BKPT;
} }
if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc)); pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));

View File

@@ -231,7 +231,7 @@ SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
rc = sqlite3VdbeMemMakeWriteable(pMem); rc = sqlite3VdbeMemMakeWriteable(pMem);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
assert( rc==SQLITE_NOMEM ); assert( rc==SQLITE_NOMEM );
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
zIn = (u8*)pMem->z; zIn = (u8*)pMem->z;
zTerm = &zIn[pMem->n&~1]; zTerm = &zIn[pMem->n&~1];
@@ -273,7 +273,7 @@ SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
zTerm = &zIn[pMem->n]; zTerm = &zIn[pMem->n];
zOut = sqlite3DbMallocRaw(pMem->db, len); zOut = sqlite3DbMallocRaw(pMem->db, len);
if( !zOut ){ if( !zOut ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
z = zOut; z = zOut;

View File

@@ -38,7 +38,7 @@ static int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
sqlite3_stmt *pStmt; sqlite3_stmt *pStmt;
VVA_ONLY( int rc; ) VVA_ONLY( int rc; )
if( !zSql ){ if( !zSql ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){ if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){
sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db)); sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));
@@ -219,7 +219,7 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
|| (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0)) || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))
|| NEVER(db->mallocFailed) || NEVER(db->mallocFailed)
){ ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto end_of_vacuum; goto end_of_vacuum;
} }

View File

@@ -5315,7 +5315,7 @@ case OP_ParseSchema: {
"SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid", "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
db->aDb[iDb].zName, zMaster, pOp->p4.z); db->aDb[iDb].zName, zMaster, pOp->p4.z);
if( zSql==0 ){ if( zSql==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
assert( db->init.busy==0 ); assert( db->init.busy==0 );
db->init.busy = 1; db->init.busy = 1;
@@ -6816,7 +6816,7 @@ too_big:
no_mem: no_mem:
sqlite3OomFault(db); sqlite3OomFault(db);
sqlite3VdbeError(p, "out of memory"); sqlite3VdbeError(p, "out of memory");
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto vdbe_error_halt; goto vdbe_error_halt;
/* Jump to here for any other kind of fatal error. The "rc" variable /* Jump to here for any other kind of fatal error. The "rc" variable
@@ -6824,7 +6824,7 @@ no_mem:
*/ */
abort_due_to_error: abort_due_to_error:
assert( p->zErrMsg==0 ); assert( p->zErrMsg==0 );
if( db->mallocFailed ) rc = SQLITE_NOMEM; if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT;
if( rc!=SQLITE_IOERR_NOMEM ){ if( rc!=SQLITE_IOERR_NOMEM ){
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc)); sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
} }
@@ -6835,7 +6835,7 @@ abort_due_to_error:
*/ */
abort_due_to_interrupt: abort_due_to_interrupt:
assert( db->u1.isInterrupted ); assert( db->u1.isInterrupted );
rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_INTERRUPT; rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;
p->rc = rc; p->rc = rc;
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc)); sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
goto vdbe_error_halt; goto vdbe_error_halt;

View File

@@ -471,7 +471,7 @@ void sqlite3_result_error_toobig(sqlite3_context *pCtx){
void sqlite3_result_error_nomem(sqlite3_context *pCtx){ void sqlite3_result_error_nomem(sqlite3_context *pCtx){
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
sqlite3VdbeMemSetNull(pCtx->pOut); sqlite3VdbeMemSetNull(pCtx->pOut);
pCtx->isError = SQLITE_NOMEM; pCtx->isError = SQLITE_NOMEM_BKPT;
pCtx->fErrorOrAux = 1; pCtx->fErrorOrAux = 1;
sqlite3OomFault(pCtx->pOut->db); sqlite3OomFault(pCtx->pOut->db);
} }
@@ -547,7 +547,7 @@ static int sqlite3Step(Vdbe *p){
db = p->db; db = p->db;
if( db->mallocFailed ){ if( db->mallocFailed ){
p->rc = SQLITE_NOMEM; p->rc = SQLITE_NOMEM;
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
if( p->pc<=0 && p->expired ){ if( p->pc<=0 && p->expired ){
@@ -610,7 +610,7 @@ static int sqlite3Step(Vdbe *p){
db->errCode = rc; db->errCode = rc;
if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){ if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){
p->rc = SQLITE_NOMEM; p->rc = SQLITE_NOMEM_BKPT;
} }
end_of_step: end_of_step:
/* At this point local variable rc holds the value that should be /* At this point local variable rc holds the value that should be
@@ -677,7 +677,7 @@ int sqlite3_step(sqlite3_stmt *pStmt){
v->rc = rc2; v->rc = rc2;
} else { } else {
v->zErrMsg = 0; v->zErrMsg = 0;
v->rc = rc = SQLITE_NOMEM; v->rc = rc = SQLITE_NOMEM_BKPT;
} }
} }
rc = sqlite3ApiExit(db, rc); rc = sqlite3ApiExit(db, rc);

View File

@@ -129,7 +129,7 @@ static int growOpArray(Vdbe *v, int nOp){
p->nOpAlloc = p->szOpAlloc/sizeof(Op); p->nOpAlloc = p->szOpAlloc/sizeof(Op);
v->aOp = pNew; v->aOp = pNew;
} }
return (pNew ? SQLITE_OK : SQLITE_NOMEM); return (pNew ? SQLITE_OK : SQLITE_NOMEM_BKPT);
} }
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
@@ -1530,7 +1530,7 @@ int sqlite3VdbeList(
releaseMemArray(pMem, 8); releaseMemArray(pMem, 8);
p->pResultSet = 0; p->pResultSet = 0;
if( p->rc==SQLITE_NOMEM ){ if( p->rc==SQLITE_NOMEM_BKPT ){
/* This happens if a malloc() inside a call to sqlite3_column_text() or /* This happens if a malloc() inside a call to sqlite3_column_text() or
** sqlite3_column_text16() failed. */ ** sqlite3_column_text16() failed. */
sqlite3OomFault(db); sqlite3OomFault(db);
@@ -2119,7 +2119,7 @@ int sqlite3VdbeSetColName(
assert( var<COLNAME_N ); assert( var<COLNAME_N );
if( p->db->mallocFailed ){ if( p->db->mallocFailed ){
assert( !zName || xDel!=SQLITE_DYNAMIC ); assert( !zName || xDel!=SQLITE_DYNAMIC );
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
assert( p->aColName!=0 ); assert( p->aColName!=0 );
pColName = &(p->aColName[idx+var*p->nResColumn]); pColName = &(p->aColName[idx+var*p->nResColumn]);
@@ -2237,7 +2237,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
/* Select a master journal file name */ /* Select a master journal file name */
nMainFile = sqlite3Strlen30(zMainFile); nMainFile = sqlite3Strlen30(zMainFile);
zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz", zMainFile); zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz", zMainFile);
if( zMaster==0 ) return SQLITE_NOMEM; if( zMaster==0 ) return SQLITE_NOMEM_BKPT;
do { do {
u32 iRandom; u32 iRandom;
if( retryCount ){ if( retryCount ){
@@ -2527,7 +2527,7 @@ int sqlite3VdbeHalt(Vdbe *p){
*/ */
if( db->mallocFailed ){ if( db->mallocFailed ){
p->rc = SQLITE_NOMEM; p->rc = SQLITE_NOMEM_BKPT;
} }
if( p->aOnceFlag ) memset(p->aOnceFlag, 0, p->nOnceFlag); if( p->aOnceFlag ) memset(p->aOnceFlag, 0, p->nOnceFlag);
closeAllCursors(p); closeAllCursors(p);
@@ -2688,7 +2688,7 @@ int sqlite3VdbeHalt(Vdbe *p){
p->magic = VDBE_MAGIC_HALT; p->magic = VDBE_MAGIC_HALT;
checkActiveVdbeCnt(db); checkActiveVdbeCnt(db);
if( db->mallocFailed ){ if( db->mallocFailed ){
p->rc = SQLITE_NOMEM; p->rc = SQLITE_NOMEM_BKPT;
} }
/* If the auto-commit flag is set to true, then any locks that were held /* If the auto-commit flag is set to true, then any locks that were held
@@ -3666,7 +3666,7 @@ static int vdbeCompareMemString(
v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc); v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);
n2 = v2==0 ? 0 : c2.n; n2 = v2==0 ? 0 : c2.n;
rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2); rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);
if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM; if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM_BKPT;
sqlite3VdbeMemRelease(&c1); sqlite3VdbeMemRelease(&c1);
sqlite3VdbeMemRelease(&c2); sqlite3VdbeMemRelease(&c2);
return rc; return rc;

View File

@@ -138,7 +138,7 @@ SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){
sqlite3VdbeMemSetNull(pMem); sqlite3VdbeMemSetNull(pMem);
pMem->z = 0; pMem->z = 0;
pMem->szMalloc = 0; pMem->szMalloc = 0;
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
}else{ }else{
pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
} }
@@ -196,7 +196,7 @@ int sqlite3VdbeMemMakeWriteable(Mem *pMem){
f = pMem->flags; f = pMem->flags;
if( (f&(MEM_Str|MEM_Blob)) && (pMem->szMalloc==0 || pMem->z!=pMem->zMalloc) ){ if( (f&(MEM_Str|MEM_Blob)) && (pMem->szMalloc==0 || pMem->z!=pMem->zMalloc) ){
if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){ if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pMem->z[pMem->n] = 0; pMem->z[pMem->n] = 0;
pMem->z[pMem->n+1] = 0; pMem->z[pMem->n+1] = 0;
@@ -228,7 +228,7 @@ int sqlite3VdbeMemExpandBlob(Mem *pMem){
nByte = 1; nByte = 1;
} }
if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){ if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memset(&pMem->z[pMem->n], 0, pMem->u.nZero); memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
@@ -245,7 +245,7 @@ int sqlite3VdbeMemExpandBlob(Mem *pMem){
*/ */
static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){ if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pMem->z[pMem->n] = 0; pMem->z[pMem->n] = 0;
pMem->z[pMem->n+1] = 0; pMem->z[pMem->n+1] = 0;
@@ -294,7 +294,7 @@ int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){ if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
/* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8 /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
@@ -905,7 +905,7 @@ int sqlite3VdbeMemSetStr(
testcase( nAlloc==31 ); testcase( nAlloc==31 );
testcase( nAlloc==32 ); testcase( nAlloc==32 );
if( sqlite3VdbeMemClearAndResize(pMem, MAX(nAlloc,32)) ){ if( sqlite3VdbeMemClearAndResize(pMem, MAX(nAlloc,32)) ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memcpy(pMem->z, z, nAlloc); memcpy(pMem->z, z, nAlloc);
}else if( xDel==SQLITE_DYNAMIC ){ }else if( xDel==SQLITE_DYNAMIC ){
@@ -925,7 +925,7 @@ int sqlite3VdbeMemSetStr(
#ifndef SQLITE_OMIT_UTF16 #ifndef SQLITE_OMIT_UTF16
if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){ if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
#endif #endif
@@ -1204,7 +1204,7 @@ static int valueFromFunction(
if( pList ){ if( pList ){
apVal = (sqlite3_value**)sqlite3DbMallocZero(db, sizeof(apVal[0]) * nVal); apVal = (sqlite3_value**)sqlite3DbMallocZero(db, sizeof(apVal[0]) * nVal);
if( apVal==0 ){ if( apVal==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto value_from_function_out; goto value_from_function_out;
} }
for(i=0; i<nVal; i++){ for(i=0; i<nVal; i++){
@@ -1215,7 +1215,7 @@ static int valueFromFunction(
pVal = valueNew(db, pCtx); pVal = valueNew(db, pCtx);
if( pVal==0 ){ if( pVal==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto value_from_function_out; goto value_from_function_out;
} }
@@ -1388,7 +1388,7 @@ no_mem:
#else #else
assert( pCtx==0 ); sqlite3ValueFree(pVal); assert( pCtx==0 ); sqlite3ValueFree(pVal);
#endif #endif
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
/* /*
@@ -1637,7 +1637,7 @@ int sqlite3Stat4Column(
if( iField>nRec ) return SQLITE_CORRUPT_BKPT; if( iField>nRec ) return SQLITE_CORRUPT_BKPT;
if( pMem==0 ){ if( pMem==0 ){
pMem = *ppVal = sqlite3ValueNew(db); pMem = *ppVal = sqlite3ValueNew(db);
if( pMem==0 ) return SQLITE_NOMEM; if( pMem==0 ) return SQLITE_NOMEM_BKPT;
} }
sqlite3VdbeSerialGet(&a[iField-szField], t, pMem); sqlite3VdbeSerialGet(&a[iField-szField], t, pMem);
pMem->enc = ENC(db); pMem->enc = ENC(db);

View File

@@ -540,7 +540,7 @@ static int vdbePmaReadBlob(
int nNew = MAX(128, p->nAlloc*2); int nNew = MAX(128, p->nAlloc*2);
while( nByte>nNew ) nNew = nNew*2; while( nByte>nNew ) nNew = nNew*2;
aNew = sqlite3Realloc(p->aAlloc, nNew); aNew = sqlite3Realloc(p->aAlloc, nNew);
if( !aNew ) return SQLITE_NOMEM; if( !aNew ) return SQLITE_NOMEM_BKPT;
p->nAlloc = nNew; p->nAlloc = nNew;
p->aAlloc = aNew; p->aAlloc = aNew;
} }
@@ -652,7 +652,7 @@ static int vdbePmaReaderSeek(
int iBuf = pReadr->iReadOff % pgsz; int iBuf = pReadr->iReadOff % pgsz;
if( pReadr->aBuffer==0 ){ if( pReadr->aBuffer==0 ){
pReadr->aBuffer = (u8*)sqlite3Malloc(pgsz); pReadr->aBuffer = (u8*)sqlite3Malloc(pgsz);
if( pReadr->aBuffer==0 ) rc = SQLITE_NOMEM; if( pReadr->aBuffer==0 ) rc = SQLITE_NOMEM_BKPT;
pReadr->nBuffer = pgsz; pReadr->nBuffer = pgsz;
} }
if( rc==SQLITE_OK && iBuf ){ if( rc==SQLITE_OK && iBuf ){
@@ -968,7 +968,7 @@ int sqlite3VdbeSorterInit(
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo); pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
pCsr->uc.pSorter = pSorter; pCsr->uc.pSorter = pSorter;
if( pSorter==0 ){ if( pSorter==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz); pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo); memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
@@ -1002,7 +1002,7 @@ int sqlite3VdbeSorterInit(
assert( pSorter->iMemory==0 ); assert( pSorter->iMemory==0 );
pSorter->nMemory = pgsz; pSorter->nMemory = pgsz;
pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz); pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz);
if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM; if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM_BKPT;
} }
} }
@@ -1324,7 +1324,7 @@ static int vdbeSortAllocUnpacked(SortSubtask *pTask){
pTask->pSorter->pKeyInfo, 0, 0, &pFree pTask->pSorter->pKeyInfo, 0, 0, &pFree
); );
assert( pTask->pUnpacked==(UnpackedRecord*)pFree ); assert( pTask->pUnpacked==(UnpackedRecord*)pFree );
if( pFree==0 ) return SQLITE_NOMEM; if( pFree==0 ) return SQLITE_NOMEM_BKPT;
pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nField; pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nField;
pTask->pUnpacked->errCode = 0; pTask->pUnpacked->errCode = 0;
} }
@@ -1399,7 +1399,7 @@ static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){
aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *)); aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *));
if( !aSlot ){ if( !aSlot ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
while( p ){ while( p ){
@@ -1449,7 +1449,7 @@ static void vdbePmaWriterInit(
memset(p, 0, sizeof(PmaWriter)); memset(p, 0, sizeof(PmaWriter));
p->aBuffer = (u8*)sqlite3Malloc(nBuf); p->aBuffer = (u8*)sqlite3Malloc(nBuf);
if( !p->aBuffer ){ if( !p->aBuffer ){
p->eFWErr = SQLITE_NOMEM; p->eFWErr = SQLITE_NOMEM_BKPT;
}else{ }else{
p->iBufEnd = p->iBufStart = (iStart % nBuf); p->iBufEnd = p->iBufStart = (iStart % nBuf);
p->iWriteOff = iStart - p->iBufStart; p->iWriteOff = iStart - p->iBufStart;
@@ -1737,7 +1737,7 @@ static int vdbeSorterFlushPMA(VdbeSorter *pSorter){
pSorter->nMemory = sqlite3MallocSize(aMem); pSorter->nMemory = sqlite3MallocSize(aMem);
}else if( pSorter->list.aMemory ){ }else if( pSorter->list.aMemory ){
pSorter->list.aMemory = sqlite3Malloc(pSorter->nMemory); pSorter->list.aMemory = sqlite3Malloc(pSorter->nMemory);
if( !pSorter->list.aMemory ) return SQLITE_NOMEM; if( !pSorter->list.aMemory ) return SQLITE_NOMEM_BKPT;
} }
rc = vdbeSorterCreateThread(pTask, vdbeSorterFlushThread, pCtx); rc = vdbeSorterCreateThread(pTask, vdbeSorterFlushThread, pCtx);
@@ -1828,7 +1828,7 @@ int sqlite3VdbeSorterWrite(
if( nNew < nMin ) nNew = nMin; if( nNew < nMin ) nNew = nMin;
aNew = sqlite3Realloc(pSorter->list.aMemory, nNew); aNew = sqlite3Realloc(pSorter->list.aMemory, nNew);
if( !aNew ) return SQLITE_NOMEM; if( !aNew ) return SQLITE_NOMEM_BKPT;
pSorter->list.pList = (SorterRecord*)&aNew[iListOff]; pSorter->list.pList = (SorterRecord*)&aNew[iListOff];
pSorter->list.aMemory = aNew; pSorter->list.aMemory = aNew;
pSorter->nMemory = nNew; pSorter->nMemory = nNew;
@@ -1842,7 +1842,7 @@ int sqlite3VdbeSorterWrite(
}else{ }else{
pNew = (SorterRecord *)sqlite3Malloc(nReq); pNew = (SorterRecord *)sqlite3Malloc(nReq);
if( pNew==0 ){ if( pNew==0 ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pNew->u.pNext = pSorter->list.pList; pNew->u.pNext = pSorter->list.pList;
} }
@@ -1989,7 +1989,7 @@ static int vdbeIncrMergerNew(
pTask->file2.iEof += pIncr->mxSz; pTask->file2.iEof += pIncr->mxSz;
}else{ }else{
vdbeMergeEngineFree(pMerger); vdbeMergeEngineFree(pMerger);
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
return rc; return rc;
} }
@@ -2294,7 +2294,7 @@ static int vdbeMergeEngineLevel0(
int rc = SQLITE_OK; int rc = SQLITE_OK;
*ppOut = pNew = vdbeMergeEngineNew(nPMA); *ppOut = pNew = vdbeMergeEngineNew(nPMA);
if( pNew==0 ) rc = SQLITE_NOMEM; if( pNew==0 ) rc = SQLITE_NOMEM_BKPT;
for(i=0; i<nPMA && rc==SQLITE_OK; i++){ for(i=0; i<nPMA && rc==SQLITE_OK; i++){
i64 nDummy; i64 nDummy;
@@ -2365,7 +2365,7 @@ static int vdbeSorterAddToTree(
if( pReadr->pIncr==0 ){ if( pReadr->pIncr==0 ){
MergeEngine *pNew = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT); MergeEngine *pNew = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT);
if( pNew==0 ){ if( pNew==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr); rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr);
} }
@@ -2410,7 +2410,7 @@ static int vdbeSorterMergeTreeBuild(
assert( pSorter->bUseThreads || pSorter->nTask==1 ); assert( pSorter->bUseThreads || pSorter->nTask==1 );
if( pSorter->nTask>1 ){ if( pSorter->nTask>1 ){
pMain = vdbeMergeEngineNew(pSorter->nTask); pMain = vdbeMergeEngineNew(pSorter->nTask);
if( pMain==0 ) rc = SQLITE_NOMEM; if( pMain==0 ) rc = SQLITE_NOMEM_BKPT;
} }
#endif #endif
@@ -2428,7 +2428,7 @@ static int vdbeSorterMergeTreeBuild(
int i; int i;
int iSeq = 0; int iSeq = 0;
pRoot = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT); pRoot = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT);
if( pRoot==0 ) rc = SQLITE_NOMEM; if( pRoot==0 ) rc = SQLITE_NOMEM_BKPT;
for(i=0; i<pTask->nPMA && rc==SQLITE_OK; i += SORTER_MAX_MERGE_COUNT){ for(i=0; i<pTask->nPMA && rc==SQLITE_OK; i += SORTER_MAX_MERGE_COUNT){
MergeEngine *pMerger = 0; /* New level-0 PMA merger */ MergeEngine *pMerger = 0; /* New level-0 PMA merger */
int nReader; /* Number of level-0 PMAs to merge */ int nReader; /* Number of level-0 PMAs to merge */
@@ -2499,7 +2499,7 @@ static int vdbeSorterSetupMerge(VdbeSorter *pSorter){
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
pReadr = (PmaReader*)sqlite3DbMallocZero(db, sizeof(PmaReader)); pReadr = (PmaReader*)sqlite3DbMallocZero(db, sizeof(PmaReader));
pSorter->pReader = pReadr; pSorter->pReader = pReadr;
if( pReadr==0 ) rc = SQLITE_NOMEM; if( pReadr==0 ) rc = SQLITE_NOMEM_BKPT;
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = vdbeIncrMergerNew(pLast, pMain, &pReadr->pIncr); rc = vdbeIncrMergerNew(pLast, pMain, &pReadr->pIncr);
@@ -2676,7 +2676,7 @@ int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){
pSorter = pCsr->uc.pSorter; pSorter = pCsr->uc.pSorter;
pKey = vdbeSorterRowkey(pSorter, &nKey); pKey = vdbeSorterRowkey(pSorter, &nKey);
if( sqlite3VdbeMemClearAndResize(pOut, nKey) ){ if( sqlite3VdbeMemClearAndResize(pOut, nKey) ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pOut->n = nKey; pOut->n = nKey;
MemSetTypeFlag(pOut, MEM_Blob); MemSetTypeFlag(pOut, MEM_Blob);
@@ -2721,7 +2721,7 @@ int sqlite3VdbeSorterCompare(
char *p; char *p;
r2 = pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pKeyInfo,0,0,&p); r2 = pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pKeyInfo,0,0,&p);
assert( pSorter->pUnpacked==(UnpackedRecord*)p ); assert( pSorter->pUnpacked==(UnpackedRecord*)p );
if( r2==0 ) return SQLITE_NOMEM; if( r2==0 ) return SQLITE_NOMEM_BKPT;
r2->nField = nKeyCol; r2->nField = nKeyCol;
} }
assert( r2->nField==nKeyCol ); assert( r2->nField==nKeyCol );

View File

@@ -506,13 +506,13 @@ static int vtabCallConstructor(
zModuleName = sqlite3MPrintf(db, "%s", pTab->zName); zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);
if( !zModuleName ){ if( !zModuleName ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pVTable = sqlite3DbMallocZero(db, sizeof(VTable)); pVTable = sqlite3DbMallocZero(db, sizeof(VTable));
if( !pVTable ){ if( !pVTable ){
sqlite3DbFree(db, zModuleName); sqlite3DbFree(db, zModuleName);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pVTable->db = db; pVTable->db = db;
pVTable->pMod = pMod; pVTable->pMod = pMod;
@@ -655,7 +655,7 @@ static int growVTrans(sqlite3 *db){
int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR); int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR);
aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes); aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes);
if( !aVTrans ){ if( !aVTrans ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR); memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR);
db->aVTrans = aVTrans; db->aVTrans = aVTrans;
@@ -747,7 +747,7 @@ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
pParse = sqlite3StackAllocZero(db, sizeof(*pParse)); pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
if( pParse==0 ){ if( pParse==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
pParse->declareVtab = 1; pParse->declareVtab = 1;
pParse->db = db; pParse->db = db;

View File

@@ -546,7 +546,7 @@ static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
apNew = (volatile u32 **)sqlite3_realloc64((void *)pWal->apWiData, nByte); apNew = (volatile u32 **)sqlite3_realloc64((void *)pWal->apWiData, nByte);
if( !apNew ){ if( !apNew ){
*ppPage = 0; *ppPage = 0;
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memset((void*)&apNew[pWal->nWiData], 0, memset((void*)&apNew[pWal->nWiData], 0,
sizeof(u32*)*(iPage+1-pWal->nWiData)); sizeof(u32*)*(iPage+1-pWal->nWiData));
@@ -558,7 +558,7 @@ static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
if( pWal->apWiData[iPage]==0 ){ if( pWal->apWiData[iPage]==0 ){
if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){ if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){
pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ); pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ);
if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM; if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM_BKPT;
}else{ }else{
rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ,
pWal->writeLock, (void volatile **)&pWal->apWiData[iPage] pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]
@@ -1173,7 +1173,7 @@ static int walIndexRecover(Wal *pWal){
szFrame = szPage + WAL_FRAME_HDRSIZE; szFrame = szPage + WAL_FRAME_HDRSIZE;
aFrame = (u8 *)sqlite3_malloc64(szFrame); aFrame = (u8 *)sqlite3_malloc64(szFrame);
if( !aFrame ){ if( !aFrame ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
goto recovery_error; goto recovery_error;
} }
aData = &aFrame[WAL_FRAME_HDRSIZE]; aData = &aFrame[WAL_FRAME_HDRSIZE];
@@ -1311,7 +1311,7 @@ int sqlite3WalOpen(
*ppWal = 0; *ppWal = 0;
pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile); pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile);
if( !pRet ){ if( !pRet ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
pRet->pVfs = pVfs; pRet->pVfs = pVfs;
@@ -1575,7 +1575,7 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){
+ iLast*sizeof(ht_slot); + iLast*sizeof(ht_slot);
p = (WalIterator *)sqlite3_malloc64(nByte); p = (WalIterator *)sqlite3_malloc64(nByte);
if( !p ){ if( !p ){
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memset(p, 0, nByte); memset(p, 0, nByte);
p->nSegment = nSegment; p->nSegment = nSegment;
@@ -1587,7 +1587,7 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){
sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast) sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
); );
if( !aTmp ){ if( !aTmp ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
} }
for(i=0; rc==SQLITE_OK && i<nSegment; i++){ for(i=0; rc==SQLITE_OK && i<nSegment; i++){
@@ -2880,7 +2880,7 @@ static int walWriteOneFrame(
void *pData; /* Data actually written */ void *pData; /* Data actually written */
u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-header in */ u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-header in */
#if defined(SQLITE_HAS_CODEC) #if defined(SQLITE_HAS_CODEC)
if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM; if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM_BKPT;
#else #else
pData = pPage->pData; pData = pPage->pData;
#endif #endif
@@ -2909,7 +2909,7 @@ static int walRewriteChecksums(Wal *pWal, u32 iLast){
i64 iCksumOff; i64 iCksumOff;
aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE); aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE);
if( aBuf==0 ) return SQLITE_NOMEM; if( aBuf==0 ) return SQLITE_NOMEM_BKPT;
/* Find the checksum values to use as input for the recalculating the /* Find the checksum values to use as input for the recalculating the
** first checksum. If the first frame is frame 1 (implying that the current ** first checksum. If the first frame is frame 1 (implying that the current
@@ -3385,7 +3385,7 @@ int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){
pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr)); pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr));
if( pRet==0 ){ if( pRet==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM_BKPT;
}else{ }else{
memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr)); memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr));
*ppSnapshot = (sqlite3_snapshot*)pRet; *ppSnapshot = (sqlite3_snapshot*)pRet;

View File

@@ -1736,7 +1736,7 @@ static int whereLoopResize(sqlite3 *db, WhereLoop *p, int n){
if( p->nLSlot>=n ) return SQLITE_OK; if( p->nLSlot>=n ) return SQLITE_OK;
n = (n+7)&~7; n = (n+7)&~7;
paNew = sqlite3DbMallocRawNN(db, sizeof(p->aLTerm[0])*n); paNew = sqlite3DbMallocRawNN(db, sizeof(p->aLTerm[0])*n);
if( paNew==0 ) return SQLITE_NOMEM; if( paNew==0 ) return SQLITE_NOMEM_BKPT;
memcpy(paNew, p->aLTerm, sizeof(p->aLTerm[0])*p->nLSlot); memcpy(paNew, p->aLTerm, sizeof(p->aLTerm[0])*p->nLSlot);
if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFree(db, p->aLTerm); if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFree(db, p->aLTerm);
p->aLTerm = paNew; p->aLTerm = paNew;
@@ -1751,7 +1751,7 @@ static int whereLoopXfer(sqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){
whereLoopClearUnion(db, pTo); whereLoopClearUnion(db, pTo);
if( whereLoopResize(db, pTo, pFrom->nLTerm) ){ if( whereLoopResize(db, pTo, pFrom->nLTerm) ){
memset(&pTo->u, 0, sizeof(pTo->u)); memset(&pTo->u, 0, sizeof(pTo->u));
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
memcpy(pTo, pFrom, WHERE_LOOP_XFER_SZ); memcpy(pTo, pFrom, WHERE_LOOP_XFER_SZ);
memcpy(pTo->aLTerm, pFrom->aLTerm, pTo->nLTerm*sizeof(pTo->aLTerm[0])); memcpy(pTo->aLTerm, pFrom->aLTerm, pTo->nLTerm*sizeof(pTo->aLTerm[0]));
@@ -2033,7 +2033,7 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
if( p==0 ){ if( p==0 ){
/* Allocate a new WhereLoop to add to the end of the list */ /* Allocate a new WhereLoop to add to the end of the list */
*ppPrev = p = sqlite3DbMallocRawNN(db, sizeof(WhereLoop)); *ppPrev = p = sqlite3DbMallocRawNN(db, sizeof(WhereLoop));
if( p==0 ) return SQLITE_NOMEM; if( p==0 ) return SQLITE_NOMEM_BKPT;
whereLoopInit(p); whereLoopInit(p);
p->pNextLoop = 0; p->pNextLoop = 0;
}else{ }else{
@@ -2189,7 +2189,7 @@ static int whereLoopAddBtreeIndex(
WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */ WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */
pNew = pBuilder->pNew; pNew = pBuilder->pNew;
if( db->mallocFailed ) return SQLITE_NOMEM; if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 ); assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 ); assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
@@ -2806,7 +2806,7 @@ static int whereLoopAddVirtual(
pTab = pSrc->pTab; pTab = pSrc->pTab;
assert( IsVirtual(pTab) ); assert( IsVirtual(pTab) );
pIdxInfo = allocateIndexInfo(pParse, pWC, mUnusable, pSrc,pBuilder->pOrderBy); pIdxInfo = allocateIndexInfo(pParse, pWC, mUnusable, pSrc,pBuilder->pOrderBy);
if( pIdxInfo==0 ) return SQLITE_NOMEM; if( pIdxInfo==0 ) return SQLITE_NOMEM_BKPT;
pNew->prereq = 0; pNew->prereq = 0;
pNew->rSetup = 0; pNew->rSetup = 0;
pNew->wsFlags = WHERE_VIRTUALTABLE; pNew->wsFlags = WHERE_VIRTUALTABLE;
@@ -2816,7 +2816,7 @@ static int whereLoopAddVirtual(
nConstraint = pIdxInfo->nConstraint; nConstraint = pIdxInfo->nConstraint;
if( whereLoopResize(db, pNew, nConstraint) ){ if( whereLoopResize(db, pNew, nConstraint) ){
sqlite3DbFree(db, pIdxInfo); sqlite3DbFree(db, pIdxInfo);
return SQLITE_NOMEM; return SQLITE_NOMEM_BKPT;
} }
for(iPhase=0; iPhase<=3; iPhase++){ for(iPhase=0; iPhase<=3; iPhase++){
@@ -3521,7 +3521,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2; nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2;
nSpace += sizeof(LogEst) * nOrderBy; nSpace += sizeof(LogEst) * nOrderBy;
pSpace = sqlite3DbMallocRawNN(db, nSpace); pSpace = sqlite3DbMallocRawNN(db, nSpace);
if( pSpace==0 ) return SQLITE_NOMEM; if( pSpace==0 ) return SQLITE_NOMEM_BKPT;
aTo = (WherePath*)pSpace; aTo = (WherePath*)pSpace;
aFrom = aTo+mxChoice; aFrom = aTo+mxChoice;
memset(aFrom, 0, sizeof(aFrom[0])); memset(aFrom, 0, sizeof(aFrom[0]));