mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Fix a crash in new ALTER TABLE code that could follow an OOM.
FossilOrigin-Name: 6f1f2a0a9cd75ca43b81cc325296b843ccefe6f8040da8f2e873f49928423f10
This commit is contained in:
23
src/alter.c
23
src/alter.c
@@ -812,18 +812,19 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){
|
||||
assert( pWith->nCte>0 );
|
||||
assert( (pWith->a[0].pSelect->selFlags & SF_Expanded)==0 );
|
||||
pCopy = sqlite3WithDup(pParse->db, pWith);
|
||||
sqlite3WithPush(pParse, pCopy, 1);
|
||||
|
||||
for(i=0; i<pWith->nCte; i++){
|
||||
Select *p = pWith->a[i].pSelect;
|
||||
NameContext sNC;
|
||||
memset(&sNC, 0, sizeof(sNC));
|
||||
sNC.pParse = pParse;
|
||||
sqlite3SelectPrep(sNC.pParse, p, &sNC);
|
||||
sqlite3WalkSelect(pWalker, p);
|
||||
sqlite3RenameExprlistUnmap(pParse, pWith->a[i].pCols);
|
||||
if( pCopy ){
|
||||
sqlite3WithPush(pParse, pCopy, 1);
|
||||
for(i=0; i<pWith->nCte; i++){
|
||||
Select *p = pWith->a[i].pSelect;
|
||||
NameContext sNC;
|
||||
memset(&sNC, 0, sizeof(sNC));
|
||||
sNC.pParse = pParse;
|
||||
sqlite3SelectPrep(sNC.pParse, p, &sNC);
|
||||
sqlite3WalkSelect(pWalker, p);
|
||||
sqlite3RenameExprlistUnmap(pParse, pWith->a[i].pCols);
|
||||
}
|
||||
pParse->pWith = pCopy->pOuter;
|
||||
}
|
||||
pParse->pWith = pCopy->pOuter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user