Skip to content

Commit

Permalink
Merge pull request ESMCI#1376 from NCAR/ejh_next_fix_2
Browse files Browse the repository at this point in the history
Fixing more codacy warnings
  • Loading branch information
edhartnett authored Mar 26, 2019
2 parents feae14a + eed88a7 commit 0725be7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/clib/pio_getput_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,10 @@ int PIOc_get_var_tc(int ncid, int varid, nc_type xtype, void *buf)
if (!(startp = malloc(ndims * sizeof(PIO_Offset))))
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
if (!(countp = malloc(ndims * sizeof(PIO_Offset))))
{
free(startp);
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
}

/* Find the dimension lengths. */
for (int d = 0; d < ndims; d++)
Expand All @@ -886,9 +889,9 @@ int PIOc_get_var_tc(int ncid, int varid, nc_type xtype, void *buf)
}

ierr = PIOc_get_vars_tc(ncid, varid, startp, countp, NULL, xtype, buf);
if(startp != NULL)
if (startp)
free(startp);
if(countp != NULL)
if (countp)
free(countp);
return ierr;

Expand Down
2 changes: 1 addition & 1 deletion src/clib/pio_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2151,7 +2151,7 @@ int write_darray_multi_handler(iosystem_desc_t *ios)

/* Get decomposition information. */
if (!(iodesc = pio_get_iodesc_from_id(ioid)))
return pio_err(ios, file, PIO_EBADID, __FILE__, __LINE__);
return pio_err(ios, NULL, PIO_EBADID, __FILE__, __LINE__);

if ((mpierr = MPI_Bcast(&arraylen, 1, MPI_OFFSET, 0, ios->intercomm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
Expand Down
3 changes: 3 additions & 0 deletions src/clib/pioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,10 @@ int PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, in
if (!(tmpsort = malloc(sizeof(struct sort_map) * maplen)))
return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__);
if (!(iodesc->remap = malloc(sizeof(int) * maplen)))
{
free(tmpsort);
return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__);
}
for (int m=0; m < maplen; m++)
{
tmpsort[m].remap = m;
Expand Down
4 changes: 2 additions & 2 deletions src/clib/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ void determineiotasks(const MPI_Comm comm, int *numiotasks,int *base, int *strid

Kernel_GetPersonality(&pers, sizeof(pers));

int numIONodes,numPsets,numNodesInPset,rankInPset;
int numiotasks_per_node,remainder,numIONodes_per_pset;
int numIONodes, numPsets, numNodesInPset, rankInPset;
int numiotasks_per_node, remainder = 0, numIONodes_per_pset;
int lstride;

/* Number of computational nodes in processor set */
Expand Down

0 comments on commit 0725be7

Please sign in to comment.