Ignore a couple of known-unused results reported by Coverity

This commit is contained in:
Tim Wojtulewicz 2025-07-21 15:24:54 -07:00
parent d4cb3c8225
commit 2da3b3a2a6
3 changed files with 24 additions and 6 deletions

View file

@ -759,7 +759,9 @@ ValPtr BloomFilterVal::DoClone(CloneState* state) {
if ( bloom_filter ) {
auto bf = make_intrusive<BloomFilterVal>(bloom_filter->Clone());
assert(type);
bf->Typify(type);
if ( ! bf->Typify(type) )
reporter->InternalError("Failed to typify new bloom_filter clone, clone already had valid type");
return state->NewClone(this, std::move(bf));
}

View file

@ -496,7 +496,10 @@ void SQLite::DoExpire(double current_network_time) {
// Automatically rollback the transaction when this object is deleted.
auto deferred_rollback = util::Deferred([this]() {
char* errMsg = nullptr;
sqlite3_exec(expire_db, "rollback transaction", nullptr, nullptr, &errMsg);
if ( int status = sqlite3_exec(expire_db, "rollback transaction", nullptr, nullptr, &errMsg);
status != SQLITE_OK )
reporter->Warning("SQLite backend failed to rollback transaction during expiration: %s", errMsg);
sqlite3_free(errMsg);
});
@ -575,13 +578,21 @@ void SQLite::DoExpire(double current_network_time) {
Error(err.c_str());
}
// Get the number of changes from the delete statement. This should be identical to the num_to_expire
// value earlier because we're under a transaction, but this should be the exact number that changed.
// Get the number of changes from the delete statement. This should be identical to
// the num_to_expire value earlier because we're under a transaction, but this should
// be the exact number that changed.
int changes = sqlite3_changes(db);
IncExpiredEntriesMetric(changes);
sqlite3_exec(expire_db, "commit transaction", nullptr, nullptr, &errMsg);
status = sqlite3_exec(expire_db, "commit transaction", nullptr, nullptr, &errMsg);
if ( status != SQLITE_OK )
reporter->Warning("SQLite backend failed to commit transaction during expiration: %s", errMsg);
sqlite3_free(errMsg);
// Don't try to rollback the transaction we just committed, since sqlite will just
// report an error.
deferred_rollback.Cancel();
}
// returns true in case of error

View file

@ -68,7 +68,12 @@ private:
class Deferred {
public:
Deferred(std::function<void()> deferred) : deferred(std::move(deferred)) {}
~Deferred() { deferred(); }
~Deferred() {
if ( deferred ) {
deferred();
}
}
void Cancel() { deferred = nullptr; }
private:
std::function<void()> deferred;