summaryrefslogtreecommitdiffstats
path: root/src/H5system.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-08-01 11:59:36 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-08-01 11:59:36 (GMT)
commit9bcf8b2f2568083449ae3f9b6c2efbf6ed7f413a (patch)
treefe559cda62898d41680e12fcfdc0391859e04e8d /src/H5system.c
parentfd0d8738e07c602c1871a5052b4fe836c37b8d64 (diff)
downloadhdf5-9bcf8b2f2568083449ae3f9b6c2efbf6ed7f413a.zip
hdf5-9bcf8b2f2568083449ae3f9b6c2efbf6ed7f413a.tar.gz
hdf5-9bcf8b2f2568083449ae3f9b6c2efbf6ed7f413a.tar.bz2
Minor tweaks in response to code review.
Diffstat (limited to 'src/H5system.c')
-rw-r--r--src/H5system.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/H5system.c b/src/H5system.c
index 1e718e7..a1cdf19 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -1266,15 +1266,11 @@ H5_expand_windows_env_vars(char **env_var)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path")
/* Expand the environment variable string */
- if ((n_chars = ExpandEnvironmentStringsA(*env_var, temp_buf, H5_WIN32_ENV_VAR_BUFFER_SIZE)) > H5_WIN32_ENV_VAR_BUFFER_SIZE) {
- temp_buf = (char *)H5MM_xfree(temp_buf);
+ if ((n_chars = ExpandEnvironmentStringsA(*env_var, temp_buf, H5_WIN32_ENV_VAR_BUFFER_SIZE)) > H5_WIN32_ENV_VAR_BUFFER_SIZE)
HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long")
- }
- if (n_chars == 0) {
- temp_buf = (char *)H5MM_xfree(temp_buf);
+ if (0 == n_chars)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path")
- }
*env_var = (char *)H5MM_xfree(*env_var);
*env_var = temp_buf;