From fcf7144f1d4854dcae42c8134fd979590bf3163e Mon Sep 17 00:00:00 2001 From: Tobias Fuchs Date: Fri, 27 Feb 2015 16:27:58 +0100 Subject: [PATCH] algorithms_cpp: fixed freeing temporary buffer in MergeSortAllocate --- algorithms_cpp/include/embb/algorithms/merge_sort.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/algorithms_cpp/include/embb/algorithms/merge_sort.h b/algorithms_cpp/include/embb/algorithms/merge_sort.h index 5b921f2..d3de332 100644 --- a/algorithms_cpp/include/embb/algorithms/merge_sort.h +++ b/algorithms_cpp/include/embb/algorithms/merge_sort.h @@ -169,7 +169,13 @@ void MergeSortAllocate( typedef typename std::iterator_traits::value_type value_type; value_type* temporary = static_cast( 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); } -- libgit2 0.26.0