summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-07-09 13:36:26 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-07-09 13:36:26 (GMT)
commit2efbc227cdf2b8e24efab6c180e429f442e95f2d (patch)
treef5b3ebfaf6cef70691af6aaad19c1dc534818f28 /c++/src
parent7cdea30a3a7d28c90fd0634a0a0ed9ebf8b0b7f8 (diff)
downloadhdf5-2efbc227cdf2b8e24efab6c180e429f442e95f2d.zip
hdf5-2efbc227cdf2b8e24efab6c180e429f442e95f2d.tar.gz
hdf5-2efbc227cdf2b8e24efab6c180e429f442e95f2d.tar.bz2
[svn-r23875] HDFFV-8322: free allocation before throwing exception.
Tested: local linux
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5CommonFG.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index b3889a0..0651c29 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -568,8 +568,10 @@ H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const
// if H5Oget_comment_by_name returns SUCCEED, return the string comment,
// otherwise, throw an exception
- if( ret_value < 0 )
- throwException("getComment", "H5Oget_comment_by_name failed");
+ if( ret_value < 0 ) {
+ delete []comment_C;
+ throwException("getComment", "H5Oget_comment_by_name failed");
+ }
H5std_string comment = H5std_string(comment_C);
delete []comment_C;