Prevent memory leaks in case SeqILU0 throws an exception.

This commit is contained in:
Markus Blatt
2015-09-08 14:38:29 +02:00
parent 3c1498ce92
commit 32b8ed654e
2 changed files with 11 additions and 1 deletions

View File

@@ -196,6 +196,11 @@ createILU0Ptr(const M& A, double relax,
// Check whether there was a problem on some process
if ( comm.communicator().min(ilu_setup_successful) == 0 )
{
if ( ilu ) // not null if constructor succeeded
{
// prevent memory leak
delete ilu;
}
throw Dune::MatrixBlockError();
}
return typename SelectParallelILUSharedPtr<Dune::SeqILU0<M,X,X>, I1, I2>