Fossil SCM
In db_database_slow(), make sure the prepared statement gets finalized even if the db_prepare_ignore_error() call fails. See [forum:/forumpost/89b5aad9aa|forum post 89b5aad9aa] for a description of the problem that this fixes.
Commit
eddfa8dfbe830c271b5f5a7046bbba866def20bbaf7855289817df6a235f1616
Parent
3e350682607068a…
1 file changed
+6
-5
M
src/db.c
+6
-5
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1711,15 +1711,16 @@ | ||
| 1711 | 1711 | int iSlot = -1; |
| 1712 | 1712 | int rc; |
| 1713 | 1713 | Stmt q; |
| 1714 | 1714 | if( g.db==0 ) return iSlot; |
| 1715 | 1715 | rc = db_prepare_ignore_error(&q, "PRAGMA database_list"); |
| 1716 | - if( rc!=SQLITE_OK ) return iSlot; | |
| 1717 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 1718 | - if( fossil_strcmp(db_column_text(&q,1),zLabel)==0 ){ | |
| 1719 | - iSlot = db_column_int(&q, 0); | |
| 1720 | - break; | |
| 1716 | + if( rc==SQLITE_OK ){ | |
| 1717 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 1718 | + if( fossil_strcmp(db_column_text(&q,1),zLabel)==0 ){ | |
| 1719 | + iSlot = db_column_int(&q, 0); | |
| 1720 | + break; | |
| 1721 | + } | |
| 1721 | 1722 | } |
| 1722 | 1723 | } |
| 1723 | 1724 | db_finalize(&q); |
| 1724 | 1725 | return iSlot; |
| 1725 | 1726 | } |
| 1726 | 1727 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1711,15 +1711,16 @@ | |
| 1711 | int iSlot = -1; |
| 1712 | int rc; |
| 1713 | Stmt q; |
| 1714 | if( g.db==0 ) return iSlot; |
| 1715 | rc = db_prepare_ignore_error(&q, "PRAGMA database_list"); |
| 1716 | if( rc!=SQLITE_OK ) return iSlot; |
| 1717 | while( db_step(&q)==SQLITE_ROW ){ |
| 1718 | if( fossil_strcmp(db_column_text(&q,1),zLabel)==0 ){ |
| 1719 | iSlot = db_column_int(&q, 0); |
| 1720 | break; |
| 1721 | } |
| 1722 | } |
| 1723 | db_finalize(&q); |
| 1724 | return iSlot; |
| 1725 | } |
| 1726 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1711,15 +1711,16 @@ | |
| 1711 | int iSlot = -1; |
| 1712 | int rc; |
| 1713 | Stmt q; |
| 1714 | if( g.db==0 ) return iSlot; |
| 1715 | rc = db_prepare_ignore_error(&q, "PRAGMA database_list"); |
| 1716 | if( rc==SQLITE_OK ){ |
| 1717 | while( db_step(&q)==SQLITE_ROW ){ |
| 1718 | if( fossil_strcmp(db_column_text(&q,1),zLabel)==0 ){ |
| 1719 | iSlot = db_column_int(&q, 0); |
| 1720 | break; |
| 1721 | } |
| 1722 | } |
| 1723 | } |
| 1724 | db_finalize(&q); |
| 1725 | return iSlot; |
| 1726 | } |
| 1727 |