Fix crash if unable to load plugin.

This commit is contained in:
Jan Vidar Krey 2018-11-21 11:00:20 +01:00
parent f0b67ea4cd
commit c383a53105

View File

@ -102,7 +102,6 @@ struct plugin_handle* plugin_load(const char* filename, const char* config, stru
int ret;
struct plugin_handle* handle = (struct plugin_handle*) hub_malloc_zero(sizeof(struct plugin_handle));
struct uhub_plugin* plugin = plugin_open(filename);
struct plugin_hub_internals* internals = (struct plugin_hub_internals*) plugin->internals;
if (!plugin)
return NULL;
@ -118,6 +117,7 @@ struct plugin_handle* plugin_load(const char* filename, const char* config, stru
unregister_f = plugin_lookup_symbol(plugin, "plugin_unregister");
// register hub internals
struct plugin_hub_internals* internals = (struct plugin_hub_internals*) plugin->internals;
internals->unregister = unregister_f;
internals->hub = hub;
internals->callback_data = plugin_callback_data_create();