diff options
author | Elena Pourmal <epourmal@hdfgroup.org> | 2006-09-05 23:36:01 (GMT) |
---|---|---|
committer | Elena Pourmal <epourmal@hdfgroup.org> | 2006-09-05 23:36:01 (GMT) |
commit | d553c60eb0428adaa3b1d9c647a1b465b65b8408 (patch) | |
tree | 8ec4ab3b924f14a9f78f53402b7405976b055a80 /src/H5Glink.c | |
parent | 46467e91b0c96f368b2ac75569dfab2d3a097ef8 (diff) | |
download | hdf5-d553c60eb0428adaa3b1d9c647a1b465b65b8408.zip hdf5-d553c60eb0428adaa3b1d9c647a1b465b65b8408.tar.gz hdf5-d553c60eb0428adaa3b1d9c647a1b465b65b8408.tar.bz2 |
[svn-r12650] Description:
Purify found some memory leaks in the code related to the HDF5 external links.
James provided the fix and asked me to check it in.
Tested:
heping, mir, shanti, and juniper
Diffstat (limited to 'src/H5Glink.c')
-rw-r--r-- | src/H5Glink.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/H5Glink.c b/src/H5Glink.c index 1139e7c..018088e 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -334,10 +334,15 @@ H5G_link_convert(H5O_link_t *lnk, const H5G_entry_t *ent, const H5HL_t *heap, s = H5HL_offset_into(ent->file, heap, ent->cache.ulink.udata_offset); HDassert(s); - /* Read udata from heap */ - if(NULL== (lnk->u.ud.udata = H5MM_malloc(lnk->u.ud.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for user link data") - HDmemcpy(lnk->u.ud.udata, s, lnk->u.ud.size); + /* Read udata from heap if it exists */ + if(lnk->u.ud.size > 0) + { + if(NULL== (lnk->u.ud.udata = H5MM_malloc(lnk->u.ud.size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for user link data") + HDmemcpy(lnk->u.ud.udata, s, lnk->u.ud.size); + } + else + lnk->u.ud.udata = NULL; } break; |