Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 3b4b00d

Browse files
Merge pull request #997 from igchor/fix_coverity
Fix coverity issues (not catching exception in dtor)
2 parents bc2fd84 + 6aa2318 commit 3b4b00d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

examples/transaction/transaction.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,13 @@ struct simple_ptr {
296296
~simple_ptr()
297297
{
298298
assert(pmemobj_tx_stage() == TX_STAGE_WORK);
299-
delete_persistent<T>(ptr);
299+
300+
try {
301+
delete_persistent<T>(ptr);
302+
} catch (pmem::transaction_free_error &e) {
303+
std::cerr << e.what() << std::endl;
304+
std::terminate();
305+
}
300306
}
301307

302308
persistent_ptr<T> ptr;

tests/transaction/transaction_flat.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ struct simple_ptr {
2525
{
2626
UT_ASSERT(ptr != nullptr);
2727

28-
nvobj::delete_persistent<T>(ptr);
28+
try {
29+
nvobj::delete_persistent<T>(ptr);
30+
} catch (...) {
31+
UT_ASSERT(0);
32+
}
2933
}
3034

3135
nvobj::persistent_ptr<T> ptr;
@@ -44,7 +48,11 @@ struct simple_ptr_tx {
4448
{
4549
UT_ASSERT(ptr != nullptr);
4650

47-
nvobj::delete_persistent<T>(ptr);
51+
try {
52+
nvobj::delete_persistent<T>(ptr);
53+
} catch (...) {
54+
UT_ASSERT(0);
55+
}
4856
}
4957

5058
nvobj::persistent_ptr<T> ptr;

0 commit comments

Comments
 (0)