summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-23 20:56:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-23 20:56:42 (GMT)
commit0f95a9d5ab47a609f50c7554e46f60b625df07e8 (patch)
tree2137e981bc20f6e3f40176487780a9032936d228 /src/H5Gnode.c
parent65996f2921391c653d05ad92b7b62ba27f3c2bdd (diff)
downloadhdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.zip
hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.gz
hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.bz2
[svn-r19278] Description:
More fixes to memory allocation, etc. exposed by valgrind. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r--src/H5Gnode.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index fb07c63..2b793a9 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -778,7 +778,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* "Normal" removal of a single entry from the symbol table node */
if(udata->common.name != NULL) {
H5O_link_t lnk; /* Constructed link for replacement */
- size_t len; /* Length of string in local heap */
+ size_t link_name_len; /* Length of string in local heap */
const char *base; /* Base of heap */
/* Get base address of heap */
@@ -804,6 +804,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Get a pointer to the name of the link */
if(NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name")
+ link_name_len = HDstrlen(lnk.name) + 1;
/* Set up rest of link structure */
lnk.corder_valid = FALSE;
@@ -837,15 +838,16 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
else {
/* Remove the soft link's value from the local heap */
if(lnk.u.soft.name) {
- len = HDstrlen(lnk.u.soft.name) + 1;
- if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, len) < 0)
+ size_t soft_link_len; /* Length of string in local heap */
+
+ soft_link_len = HDstrlen(lnk.u.soft.name) + 1;
+ if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, soft_link_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove soft link from local heap")
} /* end if */
} /* end else */
/* Remove the link's name from the local heap */
- len = HDstrlen(lnk.name) + 1;
- if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].name_off, len) < 0)
+ if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].name_off, link_name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove link name from local heap")
/* Remove the entry from the symbol table node */