Skip to content

Commit

Permalink
fix mem error
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Jun 9, 2020
1 parent 038b3a7 commit 1c448af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/clib/pio_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,19 @@ PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen,
{
if (!(tmparray = malloc(iodesc->piotype_size * iodesc->maplen)))
return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__);
for (int m = 0; m < iodesc->maplen; m++)
if(iodesc->piotype_size == 1){
for (int m = 0; m < iodesc->maplen; m++)
((signed char *)array)[m] = -1;
}else if(iodesc->piotype_size == 2){
for (int m = 0; m < iodesc->maplen; m++)
((short *)array)[m] = -1;
}else if(iodesc->piotype_size == 4){
for (int m = 0; m < iodesc->maplen; m++)
((int *)array)[m] = -1;
}else if(iodesc->piotype_size == 8){
for (int m = 0; m < iodesc->maplen; m++)
((double *)array)[m] = -1;
}
}
else
tmparray = array;
Expand Down
1 change: 0 additions & 1 deletion src/flib/piodarray.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ contains
!<
subroutine read_darray_{DIMS}d_{TYPE} (File,varDesc, ioDesc, array, iostat)
use iso_c_binding
! use ifcore, only: tracebackqq

type (File_desc_t), intent(inout) :: &
File ! file information
Expand Down

0 comments on commit 1c448af

Please sign in to comment.