1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-06 08:21:01 +03:00

Fix some memory leaks and crashes that could follow an OOM condition during WITH clause parsing.

FossilOrigin-Name: 8839850c44a8938883e493eacd752fa686e542df
This commit is contained in:
dan
2014-01-13 16:36:40 +00:00
parent 4e9119d9e8
commit a9f5c13d0c
5 changed files with 36 additions and 12 deletions

View File

@@ -4234,12 +4234,13 @@ With *sqlite3WithAdd(
pNew = sqlite3DbMallocZero(db, sizeof(*pWith));
}
assert( zName!=0 || pNew==0 );
assert( db->mallocFailed==0 || pNew==0 );
if( pNew==0 ){
sqlite3WithDelete(db, pWith);
sqlite3ExprListDelete(db, pArglist);
sqlite3SelectDelete(db, pQuery);
sqlite3DbFree(db, zName);
pNew = pWith;
}else{
pNew->a[pNew->nCte].pSelect = pQuery;
pNew->a[pNew->nCte].pCols = pArglist;