diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-12-06 17:00:14 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-12-06 17:00:14 (GMT) |
commit | 49b662bd0d0ea818dd53bac407070a711f45ef03 (patch) | |
tree | 35f69557b245c68a7e44c7decb2992e4b25d6170 | |
parent | 9bea2a7ffbb51d14387fa71060ad6bafc8d443af (diff) | |
download | hdf5-49b662bd0d0ea818dd53bac407070a711f45ef03.zip hdf5-49b662bd0d0ea818dd53bac407070a711f45ef03.tar.gz hdf5-49b662bd0d0ea818dd53bac407070a711f45ef03.tar.bz2 |
[svn-r13024]
fixed 2 initializations of char* with HDstrdup and HDcalloc
info->prefix = HDcalloc(1, 1);
fname = HDstrdup(argv[opt_ind]);
some were exposed by compiler warnings
-rw-r--r-- | tools/h5dump/h5dump.c | 22 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 2 |
2 files changed, 13 insertions, 11 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index c362776..9768272 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -682,7 +682,7 @@ usage(const char *prog) static void print_datatype(hid_t type,unsigned in_group) { - char *fname; + char *mname; hid_t mtype, str_type; unsigned nmembers; unsigned ndims; @@ -1004,7 +1004,7 @@ done: printf("H5T_COMPOUND %s\n", dump_header_format->structblockbegin); for (i = 0; i < nmembers; i++) { - fname = H5Tget_member_name(type, i); + mname = H5Tget_member_name(type, i); mtype = H5Tget_member_type(type, i); indentation(indent + COL); @@ -1016,8 +1016,8 @@ done: if (H5Tget_class(mtype) == H5T_COMPOUND) indent -= COL; - printf(" \"%s\";\n", fname); - free(fname); + printf(" \"%s\";\n", mname); + free(mname); } indentation(indent); @@ -3717,7 +3717,7 @@ int main(int argc, const char *argv[]) { hid_t fid, gid; - const char *fname = NULL; + char *fname = NULL; void *edata; H5E_auto_stack_t func; find_objs_t info; @@ -3771,7 +3771,7 @@ main(int argc, const char *argv[]) usage(progname); leave(EXIT_FAILURE); } - fname = argv[opt_ind]; + fname = HDstrdup(argv[opt_ind]); fid = h5tools_fopen(fname, driver, NULL, 0); @@ -3917,6 +3917,8 @@ done: free_table(type_table); HDfree(prefix); + HDfree(info.prefix); + HDfree(fname); /* To Do: clean up XML table */ @@ -4285,7 +4287,7 @@ xml_escape_the_string(const char *str, int slen) static void xml_print_datatype(hid_t type, unsigned in_group) { - char *fname; + char *mname; hid_t mtype; unsigned nmembers; unsigned ndims; @@ -4523,13 +4525,13 @@ xml_print_datatype(hid_t type, unsigned in_group) for (i = 0; i < nmembers; i++) { char *t_fname; - fname = H5Tget_member_name(type, i); + mname = H5Tget_member_name(type, i); mtype = H5Tget_member_type(type, i); indentation(indent); - t_fname = xml_escape_the_name(fname); + t_fname = xml_escape_the_name(mname); printf("<%sField FieldName=\"%s\">\n",xmlnsprefix, t_fname); - free(fname); + free(mname); free(t_fname); indent += COL; indentation(indent); diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 3dbafa5..e2b50b6 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -595,7 +595,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, init_table(type_table); /* Init the find_objs_t */ - info->prefix = (char *)""; + info->prefix = HDcalloc(1, 1); info->group_table = *group_table; info->type_table = *type_table; info->dset_table = *dset_table; |