diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2013-09-06 19:09:07 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2013-09-06 19:09:07 (GMT) |
commit | 38e0563a6e2bf77c860abb0ec61aa6a9da4204af (patch) | |
tree | ac2b12c47f4d66885efa0c5ae76ea0f0609b9078 /fortran/src/H5Pf.c | |
parent | ad7d03103deb0da4c12db131079088cb3446756d (diff) | |
download | hdf5-38e0563a6e2bf77c860abb0ec61aa6a9da4204af.zip hdf5-38e0563a6e2bf77c860abb0ec61aa6a9da4204af.tar.gz hdf5-38e0563a6e2bf77c860abb0ec61aa6a9da4204af.tar.bz2 |
[svn-r24112] Description:
Bring r24101 & 24111 from trunk to 1.8 branch:
r24101:
=======
Description:
Clean up warnings, enable new compiler warning flag(s) and bring back
changes from Coverity branch:
r20813:
Remove the dead code as listed for coverity bug #1722. h5committested.
r20814:
Issue 69: Check return value and throw error if negative return. Also free datatype id on error
r20815:
Use HDstrncpy. --gh
r20816:
Replaced one last HDstrcat call with HDstrncat to resolve coverity issue 832.
r20817:
Use HDstrncpy and HDstrncat. --gh
r20818:
Purpose: Fix valgrind issues with h5jam
Description:
Modified h5jam to free strings strdup'd in parse_command_line before exit. Note
that they may still not be freed in case of error, due to the widespread use of
exit().
r20819:
Issue 80: change loop to use int as loop index.
r20820:
Maintenance: Fixed the bug found by coverity CID 788
There were two problems with this function:
1) it tried to unnecessary free NULL pointer
2) it tried to allocate c_name buffer that is done by H5Pget_class_name
r24111:
=======
Description:
Restrict GCC diagnostic pragmas to only gcc 4.6+
Tested on:
Mac OSX 10.8.4 (amazon) w/gcc 4.8.1, C++ & FORTRAN
(too minor to require h5committest)
Diffstat (limited to 'fortran/src/H5Pf.c')
-rw-r--r-- | fortran/src/H5Pf.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index dba2aa4..262ce55 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -3370,14 +3370,15 @@ nh5pclose_class_c(hid_t_f *cls) ret_value = 0; return ret_value; } + /****if* H5Pf/h5pget_class_name_c * NAME * h5pget_class_name_c * PURPOSE * Call H5Pget_class_name to get property class name * INPUTS - * cls - identifier of property class - * name - ibuffer to retrieve name in + * cls - identifier of property class + * name - buffer to retrieve name in * name_len - length of the "name" buffer * RETURNS * 0 on success, -1 on failure @@ -3393,30 +3394,25 @@ nh5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len) /******/ { int_f ret_value = -1; - char *c_name = NULL; /* Buffer to hold C string */ - size_t c_size; - c_size = (size_t)*name_len + 1; - - /* - * Allocate buffer to hold name - */ - if(NULL == (c_name = (char *)HDmalloc(c_size))) - goto DONE; + /* Buffer to return name by C function */ + char *c_name; /* - * Call H5Pget_class_name function. + * Call H5Pget_class_name function. c_name is allocated by the library, + * has to be freed by application. */ - c_name = H5Pget_class_name((hid_t)*cls); - if(c_name == NULL) goto DONE; + if(NULL == (c_name = H5Pget_class_name((hid_t)*cls))) + goto DONE; HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len); ret_value = (int_f)HDstrlen(c_name); + HDfree(c_name); DONE: - HDfree(c_name); return ret_value; } + /****if* H5Pf/h5psetc_c * NAME * h5psetc_c |