Merge branch 'ejh_enum_mem_fix' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into more_ejh_pulls

This commit is contained in:
Ward Fisher 2017-11-09 16:11:17 -07:00
commit a9dde277d7
3 changed files with 12 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}