summaryrefslogtreecommitdiffstats
path: root/src/H5Gent.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-07-17 02:46:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-07-17 02:46:42 (GMT)
commit96a49c0d37ea736422c2cffe4bd22f0209e4fe24 (patch)
tree1be71f9a8081383666c91a3a5837c064fa7aaa59 /src/H5Gent.c
parent5e98b5bb36c9e0b1078e56d9b734657fcfe7a03d (diff)
downloadhdf5-96a49c0d37ea736422c2cffe4bd22f0209e4fe24.zip
hdf5-96a49c0d37ea736422c2cffe4bd22f0209e4fe24.tar.gz
hdf5-96a49c0d37ea736422c2cffe4bd22f0209e4fe24.tar.bz2
[svn-r11078] Purpose:
Bug fix Description: Correct memory leak when a dataset is attempted to be opened, but turns out to be a group or named datatype. Also, clean up code that was leading to the leak and zero out empty group entries to help prevent similar errors in the future. Platforms tested: FreebSD 4.11 (sleipnir) Too minor to require h5committest
Diffstat (limited to 'src/H5Gent.c')
-rw-r--r--src/H5Gent.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 209845c..6005b10 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -52,10 +52,10 @@ static herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type);
*
*-------------------------------------------------------------------------
*/
-H5G_cache_t *
-H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type)
+const H5G_cache_t *
+H5G_ent_cache(const H5G_entry_t *ent, H5G_type_t *cache_type)
{
- H5G_cache_t *ret_value; /* Return value */
+ const H5G_cache_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_ent_cache, NULL);
@@ -65,7 +65,7 @@ H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type)
*cache_type = ent->type;
/* Set return value */
- ret_value=&(ent->cache);
+ ret_value=(const H5G_cache_t *)&(ent->cache);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -415,6 +415,9 @@ H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5G_ent_copy_depth_t dept
} else if(depth==H5G_COPY_NULL) {
dst->user_path_r=NULL;
dst->canon_path_r=NULL;
+ } else if(depth==H5G_COPY_SHALLOW) {
+ /* Discarding 'const' qualifier OK - QAK */
+ HDmemset(src, 0, sizeof(H5G_entry_t));
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED);