Access pointer data only if it is not NULL (#809)
This PR solves the GitHub issue #808
This commit is contained in:
parent
2b1dd32d10
commit
79e4ddb5a8
@ -161,10 +161,12 @@ HYPRE_SStructMatrixDestroy( HYPRE_SStructMatrix matrix )
|
||||
hypre_SStructPGrid *pgrid;
|
||||
HYPRE_Int nvars;
|
||||
HYPRE_Int part, var;
|
||||
HYPRE_MemoryLocation memory_location = hypre_SStructMatrixMemoryLocation(matrix);
|
||||
HYPRE_MemoryLocation memory_location;
|
||||
|
||||
if (matrix)
|
||||
{
|
||||
memory_location = hypre_SStructMatrixMemoryLocation(matrix);
|
||||
|
||||
hypre_SStructMatrixRefCount(matrix) --;
|
||||
if (hypre_SStructMatrixRefCount(matrix) == 0)
|
||||
{
|
||||
|
||||
@ -79,12 +79,13 @@ HYPRE_SStructVectorDestroy( HYPRE_SStructVector vector )
|
||||
hypre_SStructPVector **pvectors;
|
||||
HYPRE_Int part;
|
||||
HYPRE_Int vector_type;
|
||||
HYPRE_MemoryLocation memory_location = hypre_SStructVectorMemoryLocation(vector);
|
||||
HYPRE_MemoryLocation memory_location;
|
||||
|
||||
/* GEC1002 destroying data indices and data in vector */
|
||||
|
||||
if (vector)
|
||||
{
|
||||
memory_location = hypre_SStructVectorMemoryLocation(vector);
|
||||
|
||||
vector_type = hypre_SStructVectorObjectType(vector);
|
||||
hypre_SStructVectorRefCount(vector) --;
|
||||
if (hypre_SStructVectorRefCount(vector) == 0)
|
||||
|
||||
@ -134,6 +134,8 @@ hypre_CommInfoDestroy( hypre_CommInfo *comm_info )
|
||||
HYPRE_Int **transforms;
|
||||
HYPRE_Int i, size;
|
||||
|
||||
if (comm_info)
|
||||
{
|
||||
size = hypre_BoxArrayArraySize(hypre_CommInfoSendBoxes(comm_info));
|
||||
hypre_BoxArrayArrayDestroy(hypre_CommInfoSendBoxes(comm_info));
|
||||
processes = hypre_CommInfoSendProcesses(comm_info);
|
||||
@ -194,6 +196,7 @@ hypre_CommInfoDestroy( hypre_CommInfo *comm_info )
|
||||
hypre_TFree(hypre_CommInfoDirs(comm_info), HYPRE_MEMORY_HOST);
|
||||
|
||||
hypre_TFree(comm_info, HYPRE_MEMORY_HOST);
|
||||
}
|
||||
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user