Have rtree avoid keeping a blob handle open following an error.

FossilOrigin-Name: 1cd5d4623f44af25ab4f5af580354b3ae22cf5de4109e008ca41055125bb708d
This commit is contained in:
dan 2024-02-12 16:12:25 +00:00
parent 38e0492b91
commit 98a8ffb3b3
3 changed files with 15 additions and 16 deletions

View File

@ -694,11 +694,9 @@ static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){
** Clear the Rtree.pNodeBlob object
*/
static void nodeBlobReset(Rtree *pRtree){
if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){
sqlite3_blob *pBlob = pRtree->pNodeBlob;
pRtree->pNodeBlob = 0;
sqlite3_blob_close(pBlob);
}
sqlite3_blob *pBlob = pRtree->pNodeBlob;
pRtree->pNodeBlob = 0;
sqlite3_blob_close(pBlob);
}
/*
@ -742,7 +740,6 @@ static int nodeAcquire(
&pRtree->pNodeBlob);
}
if( rc ){
nodeBlobReset(pRtree);
*ppNode = 0;
/* If unable to open an sqlite3_blob on the desired row, that can only
** be because the shadow tables hold erroneous data. */
@ -802,6 +799,7 @@ static int nodeAcquire(
}
*ppNode = pNode;
}else{
nodeBlobReset(pRtree);
if( pNode ){
pRtree->nNodeRef--;
sqlite3_free(pNode);
@ -1136,7 +1134,9 @@ static int rtreeClose(sqlite3_vtab_cursor *cur){
sqlite3_finalize(pCsr->pReadAux);
sqlite3_free(pCsr);
pRtree->nCursor--;
nodeBlobReset(pRtree);
if( pRtree->nCursor==0 && pRtree->inWrTrans==0 ){
nodeBlobReset(pRtree);
}
return SQLITE_OK;
}

View File

@ -1,5 +1,5 @@
C Add\sa\snew\ssqlite3FaultSim()\sto\sbtree\sfor\sbetter\sfault\sanalysis.
D 2024-02-12T14:44:35.288
C Have\srtree\savoid\skeeping\sa\sblob\shandle\sopen\sfollowing\san\serror.
D 2024-02-12T16:12:25.013
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -495,7 +495,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/geopoly.c 0dd4775e896cee6067979d67aff7c998e75c2c9d9cd8d62a1a790c09cde7adca
F ext/rtree/rtree.c 1b6422e7b9aff51583477bf8c49b51655b19bd9905b4d8fe48f4c1f0c95b2359
F ext/rtree/rtree.c bdf97fac91b37b3a6041ab4a0dd06e81c7ba1541601733b40f97fb51e76e79ce
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 2b5b8c719c6a4abe377f57766f428a49af36a93061cb146cccfdc3b30000c0a4
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
@ -2162,9 +2162,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 5ba7fee1a9b49df82387e355d2ab7de58663d3fa824e50717608b27e0f7ac874 e0558f79b8184ea6741fb20b710dab854f5bdb71aa47d5a6701eeb7389540c8c
R 0edcf4f3ab18268eaee9147c5810abce
T +closed e0558f79b8184ea6741fb20b710dab854f5bdb71aa47d5a6701eeb7389540c8c
U drh
Z b0ed70b83eb4a1ec81d9b2beb169bda8
P 2c675bd30568d3c530300beb3fcfaa17c9f063cdcb9a39ac68b9902100f641a6
R 7630f9e2445b646399b67a3fa625e210
U dan
Z 2ae954926487fe7e892424e070aafe51
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
2c675bd30568d3c530300beb3fcfaa17c9f063cdcb9a39ac68b9902100f641a6
1cd5d4623f44af25ab4f5af580354b3ae22cf5de4109e008ca41055125bb708d