diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-11-16 17:23:58 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-11-16 17:23:58 (GMT) |
commit | 191f4c1e6d4060541958d960c7f96ec014e8194f (patch) | |
tree | 35c6b9bffbc6ae136d501d91581db8412c6e96ad /src | |
parent | d45f14904bab7d998c25d05b47d8fe841049d6d5 (diff) | |
download | hdf5-191f4c1e6d4060541958d960c7f96ec014e8194f.zip hdf5-191f4c1e6d4060541958d960c7f96ec014e8194f.tar.gz hdf5-191f4c1e6d4060541958d960c7f96ec014e8194f.tar.bz2 |
Another fix for error handling
Diffstat (limited to 'src')
-rw-r--r-- | src/H5PL.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -986,6 +986,9 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **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 */ + *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; @@ -997,15 +1000,16 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **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 */ - *info = (const void *)plugin_copy; - HGOTO_DONE(TRUE) } /* end if */ } /* end for */ } /* end if */ done: + /* unallocate local copy of plugin info on failure */ + if (FAIL == ret_value && *info) { + *info = (H5Z_class2_t *)H5MM_xfree(*info); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__search_table() */ |