avoid null dereferences in delete_fluid_ladspa_plugin()

be extremely paranoid as suggested by clang-tidy
This commit is contained in:
derselbst 2017-10-21 19:01:07 +02:00
parent 6c69b8ccff
commit c205e0162d

View file

@ -1113,12 +1113,17 @@ new_fluid_ladspa_plugin(fluid_ladspa_fx_t *fx, const fluid_ladspa_lib_t *lib, co
static void delete_fluid_ladspa_plugin(fluid_ladspa_plugin_t *plugin)
{
if (plugin == NULL)
{
return;
}
if (plugin->ports != NULL)
{
FLUID_FREE(plugin->ports);
}
if (plugin->handle != NULL)
if (plugin->handle != NULL && plugin->desc != NULL && plugin->desc->cleanup != NULL)
{
plugin->desc->cleanup(plugin->handle);
}