Is there a correct way to free strings returned by functions such as H5Tget_member_name which return a char*?

The documentation says that they should be freed after use. That's all well and good until you're using two different memory allocators. For example, I'm currently developing a DLL which calls into the hdf5 libraries. Since I'm developing the dll, I'm in "_DEBUG" mode and using Microsoft's debug memory management. Therefore, if I call free on the returned pointer, it's likely to cause an access violation because the free routine does not match the alloc routine (I'm using the standard library hdf5 library straight from the web).

I found a message to the forum from back in 2009 which is almost certainly the same issue. Unfortunately, no one responded to the poor fellow.

http://hdf-forum.184993.n3.nabble.com/free-buffer-returned-by-H5Tget-member-name-result-in-runtime-error-in-Windows-Vista-tt194656.html

Ideally, there would be a free function exported from the HDF5 library which could be called to properly handle the deallocation. If there is, I haven't found it in the docs. It seems like the proper function (MMfree, or something like that) is #defined to free. Since it's a #define, it doesn't end up helping at all.

Thanks,
Jason

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to