1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

In the sqlite3SelectDup() routine, do not do an incomplete duplication due

to OOM.  This in turn requires several new NEVER() and ALWAYS() macros for
unreachable branches.

FossilOrigin-Name: a61c0e6b78bd39f55464fafd257e68effded64995a66e8fa2d686e8c507ebe43
This commit is contained in:
drh
2021-04-20 12:14:12 +00:00
parent 8c6cb1bc6f
commit 9da977f1a5
7 changed files with 24 additions and 16 deletions

View File

@@ -1648,6 +1648,14 @@ Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){
if( p->pWin && db->mallocFailed==0 ) gatherSelectWindows(pNew);
#endif
pNew->selId = p->selId;
if( db->mallocFailed ){
/* Any prior OOM might have left the Select object incomplete.
** Delete the whole thing rather than allow an incomplete Select
** to be used by the code generator. */
pNew->pNext = 0;
sqlite3SelectDelete(db, pNew);
break;
}
*pp = pNew;
pp = &pNew->pPrior;
pNext = pNew;