Skip to content

Commit f4bf46f

Browse files
committed
Fixed memory leaks in CRSMatrix::assimilate and ArrayOfArrays::free with non trivial data.
1 parent d7473c2 commit f4bf46f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/ArrayOfArraysView.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ class ArrayOfArraysView
964964

965965
typeManipulation::forEachArg( [this, begin, end] ( auto & buffer )
966966
{
967-
if( !std::is_trivially_destructible< decltype( buffer[ 0 ] ) >::value )
967+
if( !std::is_trivially_destructible< std::remove_reference_t< decltype( buffer[ 0 ] ) > >::value )
968968
{
969969
buffer.move( MemorySpace::CPU, true );
970970
for( INDEX_TYPE i = begin; i < end; ++i )

src/SparsityPatternView.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,10 @@ class SparsityPatternView : protected ArrayOfSetsView< COL_TYPE, INDEX_TYPE, BUF
407407
* @param src The SparsityPatternView to steal from.
408408
*/
409409
void assimilate( SparsityPatternView && src )
410-
{ *this = std::move( src ); }
410+
{
411+
ParentClass::free();
412+
*this = std::move( src );
413+
}
411414

412415
/**
413416
* @tparam BUFFERS A variadic pack of buffer types.

0 commit comments

Comments
 (0)