Commit 71382535 authored by Charles Law's avatar Charles Law
Browse files

Fixing a bug dereferencing NULL during delete.

parent 4e81f192
......@@ -26,7 +26,7 @@
#include "vtkMPI.h"
vtkCxxRevisionMacro(vtkMPICommunicator, "1.27");
vtkCxxRevisionMacro(vtkMPICommunicator, "1.28");
vtkStandardNewMacro(vtkMPICommunicator);
vtkCxxSetObjectMacro(vtkMPICommunicator,Group,vtkMPIGroup);
......@@ -283,15 +283,18 @@ vtkMPICommunicator::vtkMPICommunicator()
vtkMPICommunicator::~vtkMPICommunicator()
{
// Free the handle if required and asked for.
if (this->Comm->Handle && !this->KeepHandle )
if (this->Comm)
{
if (*(this->Comm->Handle) != MPI_COMM_NULL)
if (this->Comm->Handle && !this->KeepHandle )
{
MPI_Comm_free(this->Comm->Handle);
if (*(this->Comm->Handle) != MPI_COMM_NULL)
{
MPI_Comm_free(this->Comm->Handle);
}
}
delete this->Comm->Handle;
delete this->Comm;
}
delete this->Comm->Handle;
delete this->Comm;
this->SetGroup(0);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment