Make sure deleting an unused prepared statement does not reference

uninitialized fields in the structure.

FossilOrigin-Name: 7983eef0422439bfc85950554b000d46a9767ee3
This commit is contained in:
drh 2016-10-01 16:53:45 +00:00
parent 76336d5b9d
commit 8dfef1175e
3 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Avoid\saccessing\sVdbe.pc\sif\sit\sis\suninitialized.\s\sCheck\sVdbe.magic\sfirst. C Make\ssure\sdeleting\san\sunused\sprepared\sstatement\sdoes\snot\sreference\nuninitialized\sfields\sin\sthe\sstructure.
D 2016-10-01T11:39:53.849 D 2016-10-01T16:53:45.240
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
@ -457,7 +457,7 @@ F src/vdbe.c 51e754eec26d892abc6279f5e949545af68ec1b3
F src/vdbe.h c044be7050ac6bf596eecc6ab159f5dbc020a3b7 F src/vdbe.h c044be7050ac6bf596eecc6ab159f5dbc020a3b7
F src/vdbeInt.h 0a18713d0a2fec6807d076bd333d9bf3e57530cd F src/vdbeInt.h 0a18713d0a2fec6807d076bd333d9bf3e57530cd
F src/vdbeapi.c 8272f9342c39ab8d7eb4b9decc6caa7bc75b7d83 F src/vdbeapi.c 8272f9342c39ab8d7eb4b9decc6caa7bc75b7d83
F src/vdbeaux.c 4c0678a2a2c315534a2609de515d04cccf3990fb F src/vdbeaux.c 5da1f049feb4d301c7062d4359dd527b248b2e81
F src/vdbeblob.c 3e82a797b60c3b9fed7b8de8c539ca7607874937 F src/vdbeblob.c 3e82a797b60c3b9fed7b8de8c539ca7607874937
F src/vdbemem.c 1c330522e6b6e4ddd2ff63c4c0dfafa20c3965a7 F src/vdbemem.c 1c330522e6b6e4ddd2ff63c4c0dfafa20c3965a7
F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c
@ -1525,7 +1525,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 1e21bbe836539e64d24857f4faa3d12cd607dc7e P 6ac6e4462a08cb2f3d28e4a23218fc1b110a2148
R 0e838f96f4e792052b29d3f66ffac855 R 5b70bdd1179fbf3ea6befa79ac9a9864
U drh U drh
Z 89ce8b8482fb3b1340ca860c8bea3989 Z b7e8c3f1e612d35f7e8186a20da76741

View File

@ -1 +1 @@
6ac6e4462a08cb2f3d28e4a23218fc1b110a2148 7983eef0422439bfc85950554b000d46a9767ee3

View File

@ -2949,7 +2949,6 @@ void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
SubProgram *pSub, *pNext; SubProgram *pSub, *pNext;
int i; int i;
assert( p->db==0 || p->db==db ); assert( p->db==0 || p->db==db );
releaseMemArray(p->aVar, p->nVar);
releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
for(pSub=p->pProgram; pSub; pSub=pNext){ for(pSub=p->pProgram; pSub; pSub=pNext){
pNext = pSub->pNext; pNext = pSub->pNext;
@ -2957,13 +2956,14 @@ void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
sqlite3DbFree(db, pSub); sqlite3DbFree(db, pSub);
} }
if( p->magic!=VDBE_MAGIC_INIT ){ if( p->magic!=VDBE_MAGIC_INIT ){
releaseMemArray(p->aVar, p->nVar);
for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]); for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
}
sqlite3DbFree(db, p->azVar); sqlite3DbFree(db, p->azVar);
sqlite3DbFree(db, p->pFree);
}
vdbeFreeOpArray(db, p->aOp, p->nOp); vdbeFreeOpArray(db, p->aOp, p->nOp);
sqlite3DbFree(db, p->aColName); sqlite3DbFree(db, p->aColName);
sqlite3DbFree(db, p->zSql); sqlite3DbFree(db, p->zSql);
sqlite3DbFree(db, p->pFree);
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
for(i=0; i<p->nScan; i++){ for(i=0; i<p->nScan; i++){
sqlite3DbFree(db, p->aScan[i].zName); sqlite3DbFree(db, p->aScan[i].zName);