summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2010-01-08 19:22:40 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2010-01-08 19:22:40 (GMT)
commit2181d7b0c390ea32d138b7d56fd4b74aedfffe37 (patch)
tree51c249ddcb7f9d85616799a096c93a641f0a170f /tools/lib
parent11e943f0776878e4e6fa860208aa17b6770c7ba3 (diff)
downloadhdf5-2181d7b0c390ea32d138b7d56fd4b74aedfffe37.zip
hdf5-2181d7b0c390ea32d138b7d56fd4b74aedfffe37.tar.gz
hdf5-2181d7b0c390ea32d138b7d56fd4b74aedfffe37.tar.bz2
[svn-r18082] Fixed coverity issues 321 and 316.
321: freed sm_buf in error handling to remove resource leak. Also set sm_buf to NULL after other instances in which it is freed to prevent double free. 316: initialized nmembs to 0.
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 4761ab9..808ec85 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -2070,6 +2070,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
if(sm_buf)
HDfree(sm_buf);
+ sm_buf = NULL;
}
else
H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print");
@@ -2081,6 +2082,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
} /* hyperslab_count loop */
CATCH
+
+ if (sm_buf)
+ HDfree(sm_buf);
+
return ret_value;
}
@@ -3286,7 +3291,7 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type)
char **name = NULL; /*member names */
unsigned char *value = NULL; /*value array */
unsigned char *copy = NULL; /*a pointer to value array */
- unsigned nmembs; /*number of members */
+ unsigned nmembs = 0; /*number of members */
int nchars; /*number of output characters */
hid_t super = -1; /*enum base integer type */
hid_t native = -1; /*native integer datatype */