Skip to content

Commit

Permalink
working on memory warning in test_rearr.c
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Mar 25, 2019
1 parent 3422b55 commit 28185db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/cunit/test_rearr.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ int test_define_iodesc_datatypes(int my_rank)
iodesc.scount = NULL;
iodesc.sindex = NULL;
iodesc.rtype = NULL;
iodesc.stype = NULL;

/* Allocate space for arrays in iodesc that will be filled in
* define_iodesc_datatypes(). */
Expand All @@ -524,9 +525,9 @@ int test_define_iodesc_datatypes(int my_rank)
int num_send_types = iodesc.rearranger == PIO_REARR_BOX ? ios.num_iotasks : 1;

if (!(iodesc.sindex = malloc(num_send_types * sizeof(PIO_Offset))))
return PIO_ENOMEM;
BAIL(PIO_ENOMEM);
if (!(iodesc.scount = malloc(num_send_types * sizeof(int))))
return PIO_ENOMEM;
BAIL(PIO_ENOMEM);
for (int st = 0; st < num_send_types; st++)
{
iodesc.sindex[st] = 0;
Expand All @@ -540,11 +541,11 @@ int test_define_iodesc_datatypes(int my_rank)
/* We created send types, so free them. */
for (int st = 0; st < num_send_types; st++)
if ((mpierr = MPI_Type_free(&iodesc.stype[st])))
MPIERR(mpierr);
MPIBAIL(mpierr);

/* We created one receive type, so free it. */
if ((mpierr = MPI_Type_free(&iodesc.rtype[0])))
MPIERR(mpierr);
MPIBAIL(mpierr);

/* Free resources. */
if (iodesc.rtype)
Expand Down

0 comments on commit 28185db

Please sign in to comment.