diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-13 12:50:01 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-13 12:50:01 (GMT) |
commit | 6c9d003d4ee3bbcaf639149014e8e42ed9835621 (patch) | |
tree | 95169b1d25c154882a92b1c68d65c4bc65b04cc9 /hl/src/H5LT.c | |
parent | 7f46301cee98932ecf7ad87068adc0f5d051d544 (diff) | |
download | hdf5-6c9d003d4ee3bbcaf639149014e8e42ed9835621.zip hdf5-6c9d003d4ee3bbcaf639149014e8e42ed9835621.tar.gz hdf5-6c9d003d4ee3bbcaf639149014e8e42ed9835621.tar.bz2 |
[svn-r18013] Description:
Bring r18011 from trunk to 1.8 branch:
Bring Coverity changes into the trunk: (also other minor cleanups)
r17991:
Fix Coverity items 175 and 176. Fixed memory leak on error in print_enum in
H5LT.c.
r17993: (r17992 was not a Coverity change)
Close Coverity issue #206: inconsistently checking whether dt->shared was
non-NULL after H5T_alloc() returned a valid 'dt' value (which should guarantee
that dt->shared is valid).
r17994:
Fix Coverity item 149. Fixed file handle leak on error in H5FD_stdio_open.
r17995:
Fixed Coverity issues 154 to 161:
Added H5MP_close routine to error handling in the event *mp has not been
freed before error.
r17996:
Close Coverity issue #126: potentially leaking merged_spans on routine failure.
r17997:
Fix Coverity items 147 and 148. Fixed resource leaks on error in H5FDloc.c.
r17998:
Coverity issue 269-272:
Added integer result variable to functions that could return negative.
Assigned to unsigned after checking.
Added H5E_BEGIN_TRY block around H5Tclose and removed H5E_THROW in the
catch block.
Checked buffer is NULL before free. Changed HGOTO_ERROR outside of the if
block to H5E_THROW.
r17999:
Close Coverity issue #127: release temporary spans in more generic manner.
(Also add error checking to previous fix)
r18000:
Resolved Coverity issues 211 and 212 in H5T.c. Added comments to ignore
Coverity warning regarding not checking pointer for NULL, as we are using
an assert which catches the issue.
r18001:
Fix Coverity item 146. Fixed resource leak on error in H5O_layout_copy.
r18002:
Fix Coverity items 143 and 145. Fixed resource leaks on error in
H5D_compact_copy and H5D_contig_copy.
r18003:
Close Coverity issue #192: close file on error
r18004:
Fix Coverity issue #125: release temporary spans on error
r18005:
Resolved Coverity issues 5, 25, and 83 (in H5T.c):
Separated embedded functions in order to check for NULL on return of
H5I_object before passing into H5T_copy.
Check to see if new_dt is NULL within error handling before
dereferencing it.
Ignore Coverity's dead code warnings as the checks that lead to the code
are machine dependent.
r18006:
Coverity 63,70,73: Checked result of function before assigning to an unsigned
variable.
r18007:
Coverity 78,79: added continue statement if H5Pget_filter2 returns negative.
r18008:
Fixed Coverity issue # 138:
Added support in error handling to free dst pointer (if allocated) on error.
r18009:
Whitespace & coding style cleanup
Tested on:
Mac OS X/32 10.6.2 (amazon) w/debug & production
(h5committested on trunk)
Diffstat (limited to 'hl/src/H5LT.c')
-rw-r--r-- | hl/src/H5LT.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index e797d14..c38d383 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1668,7 +1668,7 @@ print_enum(hid_t type, char* str, int indt) int nmembs; /*number of members */ char tmp_str[256]; int nchars; /*number of output characters */ - hid_t super; /*enum base integer type */ + hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer data type */ size_t super_size; /*enum base type size */ size_t dst_size; /*destination value type size */ @@ -1742,21 +1742,35 @@ print_enum(hid_t type, char* str, int indt) } /* Release resources */ - for (i = 0; i < nmembs; i++) + for(i = 0; i < nmembs; i++) free(name[i]); free(name); free(value); H5Tclose(super); - if (0 == nmembs) { + if(0 == nmembs) { sprintf(tmp_str, "\n%*s <empty>", indt + 4, ""); strcat(str, tmp_str); - } + } /* end if */ return ret; out: + /* Release resources */ + if(name) { + for(i = 0; i < nmembs; i++) + if(name[i]) + free(name[i]); + free(name); + } /* end if */ + + if(value) + free(value); + + if(super >= 0) + H5Tclose(super); + return FAIL; } |