From b1d7d58d604b599a66944bb291363d7d0cf4be4b Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 25 Dec 2009 13:14:57 -0600 Subject: [PATCH] Mixer: Fix memory error and fill newly allocated chain buffers with silence. --- Mixer/Chain.C | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mixer/Chain.C b/Mixer/Chain.C index 21a6afb..995c947 100644 --- a/Mixer/Chain.C +++ b/Mixer/Chain.C @@ -71,6 +71,8 @@ #include "FL/Fl_Scroll.H" #include +#include + Chain::Chain ( int X, int Y, int W, int H, const char *L ) : Fl_Group( X, Y, W, H, L) { @@ -214,13 +216,14 @@ Chain::configure_ports ( void ) if ( port.size() != req_buffers ) { for ( unsigned int i = port.size(); i--; ) - delete[] port[i].buffer(); + delete[] (sample_t*)port[i].buffer(); port.clear(); for ( unsigned int i = 0; i < req_buffers; ++i ) { Module::Port p( NULL, Module::Port::OUTPUT, Module::Port::AUDIO ); p.connect_to( new sample_t[engine->nframes()] ); + buffer_fill_with_silence( (sample_t*)p.buffer(), engine->nframes() ); port.push_back( p ); } }