From bdd99db1c173a4bb02a19145347494eaed33a997 Mon Sep 17 00:00:00 2001 From: Garand Tyson Date: Wed, 20 Nov 2024 12:10:04 -0800 Subject: [PATCH] null check dynamic casts --- src/ledger/LedgerTxnAccountSQL.cpp | 1 + src/ledger/LedgerTxnClaimableBalanceSQL.cpp | 1 + src/ledger/LedgerTxnConfigSettingSQL.cpp | 1 + src/ledger/LedgerTxnContractCodeSQL.cpp | 1 + src/ledger/LedgerTxnContractDataSQL.cpp | 1 + src/ledger/LedgerTxnDataSQL.cpp | 1 + src/ledger/LedgerTxnLiquidityPoolSQL.cpp | 1 + src/ledger/LedgerTxnOfferSQL.cpp | 1 + src/ledger/LedgerTxnTTLSQL.cpp | 1 + src/ledger/LedgerTxnTrustLineSQL.cpp | 1 + 10 files changed, 10 insertions(+) diff --git a/src/ledger/LedgerTxnAccountSQL.cpp b/src/ledger/LedgerTxnAccountSQL.cpp index db51158f65..3313917893 100644 --- a/src/ledger/LedgerTxnAccountSQL.cpp +++ b/src/ledger/LedgerTxnAccountSQL.cpp @@ -628,6 +628,7 @@ class BulkLoadAccountsOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnClaimableBalanceSQL.cpp b/src/ledger/LedgerTxnClaimableBalanceSQL.cpp index e952589209..365efe95bf 100644 --- a/src/ledger/LedgerTxnClaimableBalanceSQL.cpp +++ b/src/ledger/LedgerTxnClaimableBalanceSQL.cpp @@ -109,6 +109,7 @@ class BulkLoadClaimableBalanceOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnConfigSettingSQL.cpp b/src/ledger/LedgerTxnConfigSettingSQL.cpp index d06282e203..dbfea378a7 100644 --- a/src/ledger/LedgerTxnConfigSettingSQL.cpp +++ b/src/ledger/LedgerTxnConfigSettingSQL.cpp @@ -112,6 +112,7 @@ class bulkLoadConfigSettingsOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnContractCodeSQL.cpp b/src/ledger/LedgerTxnContractCodeSQL.cpp index 0421e8996c..ee0aecb7c6 100644 --- a/src/ledger/LedgerTxnContractCodeSQL.cpp +++ b/src/ledger/LedgerTxnContractCodeSQL.cpp @@ -117,6 +117,7 @@ class BulkLoadContractCodeOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnContractDataSQL.cpp b/src/ledger/LedgerTxnContractDataSQL.cpp index a7f716a561..1c71f67cb7 100644 --- a/src/ledger/LedgerTxnContractDataSQL.cpp +++ b/src/ledger/LedgerTxnContractDataSQL.cpp @@ -150,6 +150,7 @@ class BulkLoadContractDataOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnDataSQL.cpp b/src/ledger/LedgerTxnDataSQL.cpp index a17a38b208..10f6ba7be5 100644 --- a/src/ledger/LedgerTxnDataSQL.cpp +++ b/src/ledger/LedgerTxnDataSQL.cpp @@ -452,6 +452,7 @@ class BulkLoadDataOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnLiquidityPoolSQL.cpp b/src/ledger/LedgerTxnLiquidityPoolSQL.cpp index ce8289b284..ae87665c5b 100644 --- a/src/ledger/LedgerTxnLiquidityPoolSQL.cpp +++ b/src/ledger/LedgerTxnLiquidityPoolSQL.cpp @@ -129,6 +129,7 @@ class BulkLoadLiquidityPoolOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnOfferSQL.cpp b/src/ledger/LedgerTxnOfferSQL.cpp index 6481bae9f7..c70e86cb6e 100644 --- a/src/ledger/LedgerTxnOfferSQL.cpp +++ b/src/ledger/LedgerTxnOfferSQL.cpp @@ -798,6 +798,7 @@ class BulkLoadOffersOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnTTLSQL.cpp b/src/ledger/LedgerTxnTTLSQL.cpp index 363923a14d..1773bca835 100644 --- a/src/ledger/LedgerTxnTTLSQL.cpp +++ b/src/ledger/LedgerTxnTTLSQL.cpp @@ -116,6 +116,7 @@ class BulkLoadTTLOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st); diff --git a/src/ledger/LedgerTxnTrustLineSQL.cpp b/src/ledger/LedgerTxnTrustLineSQL.cpp index 78631cd25a..5481bc5185 100644 --- a/src/ledger/LedgerTxnTrustLineSQL.cpp +++ b/src/ledger/LedgerTxnTrustLineSQL.cpp @@ -465,6 +465,7 @@ class BulkLoadTrustLinesOperation } auto sqliteStatement = dynamic_cast(be); + releaseAssertOrThrow(sqliteStatement); auto st = sqliteStatement->stmt_; sqlite3_reset(st);