Skip to content

Commit

Permalink
Merge branch 'ejh_enum_mem_fix' of https://github.com/NetCDF-World-Do…
Browse files Browse the repository at this point in the history
…mination-Council/netcdf-c into more_ejh_pulls
  • Loading branch information
WardF committed Nov 9, 2017
2 parents 2b749d3 + a72d5b4 commit a9dde27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions libdispatch/dfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,10 +1239,13 @@ nc_close(int ncid)
#endif
{

stat = ncp->dispatch->close(ncid);
stat = ncp->dispatch->close(ncid);
/* Remove from the nc list */
del_from_NCList(ncp);
free_NC(ncp);
if (!stat)
{
del_from_NCList(ncp);
free_NC(ncp);
}
}
return stat;
}
Expand Down
2 changes: 1 addition & 1 deletion libsrc4/nc4file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2988,7 +2988,7 @@ close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort)
exit:
/* Free the nc4_info struct; above code should have reclaimed
everything else */
if(h5 != NULL)
if(!retval && h5 != NULL)
free(h5);
return retval;
}
Expand Down
5 changes: 5 additions & 0 deletions nc_test4/tst_enums.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,13 @@ main(int argc, char **argv)
/* Close the file. */
if (nc_close(ncid) != NC_EINVAL) ERR;

unsigned char ubyte_value = 42;
if (nc_redef(ncid)) ERR;
if (nc_insert_enum(ncid, typeid, "name", &ubyte_value)) ERR;
if (nc_close(ncid)) ERR;
}

SUMMARIZE_ERR;
FINAL_RESULTS;
}

0 comments on commit a9dde27

Please sign in to comment.