summaryrefslogtreecommitdiffstats
path: root/src/H5Gstab.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-04-18 10:18:47 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-04-18 10:18:47 (GMT)
commit53eb52807100a87f5d9237367cb3005cbef1d726 (patch)
tree27c0720b572ab19988207bec44a2d806f19ca4e4 /src/H5Gstab.c
parentd38c207c3253094371ab0227dc308fd4b1c32b10 (diff)
downloadhdf5-53eb52807100a87f5d9237367cb3005cbef1d726.zip
hdf5-53eb52807100a87f5d9237367cb3005cbef1d726.tar.gz
hdf5-53eb52807100a87f5d9237367cb3005cbef1d726.tar.bz2
[svn-r20539] Description:
Bring Coverity changes back to trunk: r20276: Add recursive is vlen string function. Cleanup resource leaks for issues: 200,202,329,688,811,812 r20277: Check types and close by adding error section: issue 687 r20278: Replaced implicit pointer conversion with (ocrt_info.new_obj != NULL). r20280: Addressed coverity issues 927-929 & 583. The real issue is failure to check file name length -- at least at the H5FD interface level. This needs more work, but at least I have dealt with the issue in H5FDfamily.c r20337: H5O_type_t obj_type = H5O_TYPE_UNKNOWN; r20338: Added udata.name = NULL; to prevent potential uninitialized use after done: label. r20339: coverity issues: 686,828,1670-1673,1707-1711 Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode FreeBSD/32 8.2 (loyalty) w/gcc4.6, in debug mode FreeBSD/64 8.2 (freedom) w/gcc4.6, 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-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r--src/H5Gstab.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 7d0ad48..afa137c 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -711,6 +711,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
H5HL_t *heap = NULL; /* Pointer to local heap */
H5O_stab_t stab; /* Info about local heap & B-tree */
H5G_bt_it_gnbi_t udata; /* Iteration information */
+ hbool_t udata_valid = FALSE; /* Whether iteration information is valid */
ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_get_name_by_idx, FAIL)
@@ -744,6 +745,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
udata.common.op = H5G_stab_get_name_by_idx_cb;
udata.heap = heap;
udata.name = NULL;
+ udata_valid = TRUE;
/* Iterate over the group members */
if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_by_idx, &udata) < 0)
@@ -769,7 +771,7 @@ done:
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
/* Free the duplicated name */
- if(udata.name != NULL)
+ if(udata_valid && udata.name != NULL)
H5MM_xfree(udata.name);
FUNC_LEAVE_NOAPI(ret_value)