[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #CTP-858274]: Bug in nc_open (freeing HDF5 variable)



> Hi,
> 
> We've compiled NetCDF 4.0.1 in Visual Studio 2008 on Windows XP.  There
> is a file in the NetCDF 4.0.1 distribution called
> libsrc4\ref_tst_compounds.nc.  When I try to call nc_open on that file
> with the following code:
> 
> int fileid;
> nc_open("ref_tst_compounds.nc", NC_NOWRITE, &fileid);
> 
> there is a crash inside nc_open, in Debug mode only.  The error occurs
> at nc4hdf.c:1954, at the line that says:
> 
> /* HDF5 allocated this for us. */
> free(member_name);
> 
> What seems to be happening is that the NetCDF library is freeing a
> variable that was allocated by HDF5, and there may be an allocate/free
> mismatch that has undefined behavior, and therefore has different
> effects with different compilers / operating systems.
> 

Did you have to change the solution file to build 4.0.1? If so, can you send me 
your solution files you developed for building 4.0.1?

To answer your question, when reading vlens the HDF5 library does allocate the 
memory. I would firstly suggest you get the daily snapshot, as there have been 
memory leaks fixed since the 4.0.1 release. Get the latest snapshot here:
ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/netcdf-4-daily.tar.gz

> 
> If possible, can this be fixed in a future version of the NetCDF library?
> 

If we can find the fix, I can make sure it makes it into future releases. ;-)

Thanks,

Ed


Ticket Details
===================
Ticket ID: CTP-858274
Department: Support netCDF
Priority: Urgent
Status: Open