1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-02 05:54:29 +03:00

Fix sqlite3VdbeExpandSql() so that it handles OOMs by always returning NULL.

FossilOrigin-Name: 5a027fe4127d498e0dc0d9439131c6a29085cf0a
This commit is contained in:
drh
2016-07-23 00:43:14 +00:00
parent 9a8b9ec51c
commit cf1e395acb
4 changed files with 26 additions and 17 deletions

View File

@@ -85,12 +85,14 @@ char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){
#ifdef SQLITE_OMIT_TRACE
return 0;
#else
Vdbe *p = (Vdbe *)pStmt;
char *z;
if( p==0 || p->zSql==0 ) return 0;
sqlite3_mutex_enter(p->db->mutex);
z = sqlite3VdbeExpandSql(p, p->zSql);
sqlite3_mutex_leave(p->db->mutex);
char *z = 0;
const char *zSql = sqlite3_sql(pStmt);
if( zSql ){
Vdbe *p = (Vdbe *)pStmt;
sqlite3_mutex_enter(p->db->mutex);
z = sqlite3VdbeExpandSql(p, zSql);
sqlite3_mutex_leave(p->db->mutex);
}
return z;
#endif
}