summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-11-16 16:29:04 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-11-16 16:29:04 (GMT)
commit7644154a6ed5885e76e33e8d73c454e7effe956a (patch)
tree94b7181758fe62007a84e177bc56359f80f4b954 /src
parent90f5daedef42dbc438b211380b1e576aa48cd25b (diff)
downloadhdf5-7644154a6ed5885e76e33e8d73c454e7effe956a.zip
hdf5-7644154a6ed5885e76e33e8d73c454e7effe956a.tar.gz
hdf5-7644154a6ed5885e76e33e8d73c454e7effe956a.tar.bz2
HDFFV-10328 set external reference before copy
Diffstat (limited to 'src')
-rw-r--r--src/H5PL.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/H5PL.c b/src/H5PL.c
index 3ed63a7..67aba8a 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -914,6 +914,9 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info)
/* allocate local copy of plugin info */
if (NULL == (plugin_copy = (H5Z_class2_t *)H5MM_calloc(sizeof(H5Z_class2_t))))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin info")
+ /* Set the plugin info to return */
+ *pl_info = (const void *)plugin_copy;
+
plugin_copy->version = plugin_info->version;
plugin_copy->id = plugin_info->id;
plugin_copy->encoder_present = plugin_info->encoder_present;
@@ -925,9 +928,6 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info)
if(NULL == (plugin_copy->name = (char *)H5MM_xstrdup(plugin_info->name)))
HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "can't allocate memory for plugin info name")
- /* Set the plugin info to return */
- *pl_info = (const void *)plugin_copy;
-
/* Indicate success */
ret_value = TRUE;
} /* end if */
@@ -940,8 +940,6 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info)
done:
/* unallocate local copy of plugin info on failure */
if (FAIL == ret_value && *pl_info) {
- if (((H5Z_class2_t *)(*pl_info))->name)
- ((H5Z_class2_t *)(*pl_info))->name = (char *)H5MM_xfree(((H5Z_class2_t *)(*pl_info))->name);
*pl_info = (H5Z_class2_t *)H5MM_xfree(*pl_info);
}
FUNC_LEAVE_NOAPI(ret_value)