Commit fcf7144f by Tobias Fuchs

algorithms_cpp: fixed freeing temporary buffer in MergeSortAllocate

parent 37bbc1c3
......@@ -169,7 +169,13 @@ void MergeSortAllocate(
typedef typename std::iterator_traits<RAI>::value_type value_type;
value_type* temporary = static_cast<value_type*>(
Alloc::Allocate(distance * sizeof(value_type)));
MergeSort(first, last, temporary, comparison, policy, block_size);
EMBB_TRY {
MergeSort(first, last, temporary, comparison, policy, block_size);
} EMBB_CATCH (embb::base::ErrorException & e) {
// embb exception handling does not support catch(...) and rethrow yet.
Alloc::Free(temporary);
EMBB_THROW(embb::base::ErrorException, e.what());
}
Alloc::Free(temporary);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment