Skip to content

Commit

Permalink
cannot predetermin ndims here
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Dec 12, 2017
1 parent 99ef07d commit 1007a7a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/clib/pio_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ int inq_var_handler(iosystem_desc_t *ios)
char name_present, xtype_present, ndims_present, dimids_present, natts_present;
char name[NC_MAX_NAME + 1], *namep = NULL;
nc_type xtype, *xtypep = NULL;
/* no easy way not to hard code this array length */
int dimids[8];
int *ndimsp = NULL, *dimidsp = NULL, *nattsp = NULL;
int ndims, natts;
int mpierr;
Expand Down Expand Up @@ -1041,8 +1043,7 @@ int inq_var_handler(iosystem_desc_t *ios)
if (ndims_present)
ndimsp = &ndims;
if (dimids_present)
if (!(dimidsp = malloc(ndims)))
return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__);
dimidsp = dimids;
if (natts_present)
nattsp = &natts;

Expand All @@ -1051,8 +1052,6 @@ int inq_var_handler(iosystem_desc_t *ios)

if (ndims_present)
LOG((2, "inq_var_handler ndims = %d", ndims));
if (dimids_present)
free(dimidsp);

return PIO_NOERR;
}
Expand Down

0 comments on commit 1007a7a

Please sign in to comment.