diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-05-20 22:04:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-05-20 22:04:03 (GMT) |
commit | 1d9307bd91d51e15e408a584b4c761cacf916b96 (patch) | |
tree | e9e1e7a3b5c0e627e28985917f2e6412f17384a9 /src/H5Gname.c | |
parent | 3f11adaec28a55a5772d702752b433aa0289adaf (diff) | |
download | hdf5-1d9307bd91d51e15e408a584b4c761cacf916b96.zip hdf5-1d9307bd91d51e15e408a584b4c761cacf916b96.tar.gz hdf5-1d9307bd91d51e15e408a584b4c761cacf916b96.tar.bz2 |
[svn-r20885] Description:
Bring Coverity changes back to trunk:
r20340:
Address coverity issue 248. Set freed pointer to NULL if realloc fails, then check for NULL before attempting to close array of handles stored in memory addressed by pointer.
r20341:
Added initialization udata.path = NULL; udata.visited = NULL; to prevent unintialized use after done: label.
Do C-style initialization AFTER all variable definitions.
r20342:
Fix valgrind error in H5DUMP-XML-tall.h5
r20343:
Addressed Coverity issue 591 - check the return value of H5S_SELECT_ITER_RELEASE.
r20344:
Added initialization udata.path = NULL; to prevent uninitialized used after done: label
r20347:
Purpose: Fix memory leak in overhead.c
Description: Fixed leak in test() in overhead.c where array "had" was never
freed.
r20348:
Addressed Coverity issue 705 - added prototype for resize_configs_are_equal to cache_common.h.
r20392:
Purpose: Fix coverity issues 1677 and 1678
Description: Added return value checking for 4 funciton calls in
H5tools_get_symlink_info().
r20394:
Purpose: Fix coverity issues 1674 and 1675
Description: Modified H5Epush2() and H5E_printf_stack() to keep track of whether
va_start() has been called, and to call va_end() at the end if so.
r20395:
Should be H5MM_calloc(count * sizeof(void*)). Fixed --gh
r20396:
Should be H5MM_calloc(count * sizeof(void*)). Fixed. --gh
Tested on:
Mac OSX/32 10.6.7 (amazon) w/debug & production
(h5committested on branch)
Diffstat (limited to 'src/H5Gname.c')
-rw-r--r-- | src/H5Gname.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/H5Gname.c b/src/H5Gname.c index c7feb62..2ba2d52 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -1105,7 +1105,8 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo, /* Check for object in same file (handles mounted files) */ /* (re-verify address, in case we traversed a file mount) */ if(udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) { - udata->path = H5MM_strdup(path); + if(NULL == (udata->path = H5MM_strdup(path))) + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string") /* We found a match so we return immediately */ HGOTO_DONE(H5_ITER_STOP) @@ -1145,6 +1146,9 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * herr_t status; /* Status from iteration */ ssize_t ret_value; /* Return value */ + /* Portably clear udata struct (before FUNC_ENTER) */ + HDmemset(&udata, 0, sizeof(udata)); + FUNC_ENTER_NOAPI(H5G_get_name_by_addr, FAIL) /* Construct the link info for the file's root group */ @@ -1153,7 +1157,8 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * /* Check for root group being the object looked for */ if(root_loc.oloc->addr == loc->addr && root_loc.oloc->file == loc->file) { - udata.path = H5MM_strdup(""); + if(NULL == (udata.path = H5MM_strdup(""))) + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string") found_obj = TRUE; } /* end if */ else { |