diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-06 16:35:18 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-06 16:35:18 (GMT) |
commit | 458576c82655a32b8a0cf0ab4228a480ab6fbaeb (patch) | |
tree | bc7fafb54f946129690cb18532ee41ac5f1fbca7 /src/H5T.c | |
parent | 01dbfdefb2f0396e866543f12280f4947296adac (diff) | |
download | hdf5-458576c82655a32b8a0cf0ab4228a480ab6fbaeb.zip hdf5-458576c82655a32b8a0cf0ab4228a480ab6fbaeb.tar.gz hdf5-458576c82655a32b8a0cf0ab4228a480ab6fbaeb.tar.bz2 |
[svn-r9375] Purpose:
Bug fix
Description:
Close a couple of memory leaks
Platforms tested:
FreeBSD 4.10 (sleipnir)
Solaris 2.7 (arabica) w/purify
Linux 2.4 (verbena)
too minor for h5committest
Diffstat (limited to 'src/H5T.c')
-rw-r--r-- | src/H5T.c | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -2959,7 +2959,7 @@ H5T_open (H5G_entry_t *ent, hid_t dxpl_id) { shared_fo->fo_count++; - if(NULL == (dt = H5FL_CALLOC(H5T_t))) + if(NULL == (dt = H5FL_MALLOC(H5T_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") dt->shared=shared_fo; @@ -3012,15 +3012,9 @@ H5T_open_oid (H5G_entry_t *ent, hid_t dxpl_id) assert (ent); - if(NULL==(dt=H5FL_CALLOC(H5T_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if(NULL==(dt->shared=H5FL_MALLOC(H5T_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if (H5O_open (ent)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named data type"); - /* The fourth argument to H5O_read is dt because we've already CALLOC'ed memory for it */ - if (NULL==(dt=H5O_read (ent, H5O_DTYPE_ID, 0, dt, dxpl_id))) + if (NULL==(dt=H5O_read (ent, H5O_DTYPE_ID, 0, NULL, dxpl_id))) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header"); /* Mark the type as named and open */ @@ -3568,10 +3562,7 @@ H5T_set_size(H5T_t *dt, size_t size) } } - if((memb_type = H5T_get_member_type(dt, max_index))==NULL) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get type of member"); - - max_size = H5T_get_size(memb_type); + max_size = H5T_get_member_size(dt, max_index); if(size<(max_offset+max_size)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member "); |