diff --git a/plugins/vst_base/remote_vst_plugin.cpp b/plugins/vst_base/remote_vst_plugin.cpp index 0f9ba6c23..bfeffb0be 100644 --- a/plugins/vst_base/remote_vst_plugin.cpp +++ b/plugins/vst_base/remote_vst_plugin.cpp @@ -813,7 +813,7 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file ) void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len ) { - char buf[_len]; + char * buf = NULL; void * chunk = NULL; // various plugins need this in order to not crash when setting @@ -823,7 +823,8 @@ void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len ) // allocated buffer big enough? if( _len > actualLen ) { - // no, manually try our local buffer + // no, then manually allocate a buffer + buf = new char[_len]; chunk = buf; } @@ -831,6 +832,8 @@ void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len ) read( fd, chunk, _len ); close( fd ); pluginDispatch( 24, 0, _len, chunk ); + + delete[] buf; }