summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Gf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c
index 0b87f4d..ff4d4d0 100644
--- a/fortran/src/H5Gf.c
+++ b/fortran/src/H5Gf.c
@@ -642,7 +642,7 @@ nh5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize,
* Allocate buffer to hold the comment
*/
c_bufsize = (size_t)*bufsize;
- if(c_bufsize) c_comment = (char *)malloc(c_bufsize);
+ if(c_bufsize) c_comment = (char *)malloc(c_bufsize + 1);
if(c_comment == NULL) {
HDfree(c_name);
return ret_value;