diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp index 17b81b8f8..6a584c8f2 100644 --- a/distrho/src/DistrhoPluginVST3.cpp +++ b/distrho/src/DistrhoPluginVST3.cpp @@ -4800,6 +4800,8 @@ struct dpf_factory : v3_plugin_factory_cpp { { dpf_component** const componentptr = new dpf_component*; *componentptr = new dpf_component(hostApplication); + if (hostApplication != nullptr) + v3_cpp_obj_unref(hostApplication); *instance = static_cast(componentptr); return V3_OK; } @@ -4811,6 +4813,8 @@ struct dpf_factory : v3_plugin_factory_cpp { { dpf_edit_controller** const controllerptr = new dpf_edit_controller*; *controllerptr = new dpf_edit_controller(hostApplication); + if (hostApplication != nullptr) + v3_cpp_obj_unref(hostApplication); *instance = static_cast(controllerptr); return V3_OK; }