summaryrefslogtreecommitdiffstats
path: root/src/H5FDlog.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-06-29 09:38:14 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-06-29 09:38:14 (GMT)
commitf250815151df8da8a93c0ff781a3cf134f1c6cbd (patch)
treeaea82df0c2ef0e68c0752020b221e65e9a56e709 /src/H5FDlog.c
parent13d951d37205bcd48723330a898e5d67c5e1ecb2 (diff)
downloadhdf5-f250815151df8da8a93c0ff781a3cf134f1c6cbd.zip
hdf5-f250815151df8da8a93c0ff781a3cf134f1c6cbd.tar.gz
hdf5-f250815151df8da8a93c0ff781a3cf134f1c6cbd.tar.bz2
Cleaned up misc warnings.
Diffstat (limited to 'src/H5FDlog.c')
-rw-r--r--src/H5FDlog.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 06a0e61..ac5667f 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -331,16 +331,22 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si
HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
- /* This shallow copy is correct! The string will be properly
- * copied deep down in the H5P code.
+ /* Duplicate the log file string
+ * A little wasteful, since this string will just be copied later, but
+ * passing it in as a pointer sets off a chain of impossible-to-resolve
+ * const cast warnings.
*/
- fa.logfile = (char *)logfile;
+ if(logfile != NULL && NULL == (fa.logfile = H5MM_xstrdup(logfile)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to copy log file name")
fa.flags = flags;
fa.buf_size = buf_size;
ret_value = H5P_set_driver(plist, H5FD_LOG, &fa);
done:
+ if(fa.logfile)
+ H5MM_free(fa.logfile);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fapl_log() */