From 3072985b0a8a75186d4421f8b9c5aa8f8260658c Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 4 Apr 2015 02:06:13 -0700 Subject: [PATCH] fix segfault: allocate all ports --- util/bench.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/util/bench.c b/util/bench.c index 6f303b3..40afd2d 100644 --- a/util/bench.c +++ b/util/bench.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -56,9 +57,15 @@ main(int argc, char **argv) audio_buffer = calloc(audio_count*BLOCK_SIZE, sizeof(float)); int a = 0; - for (int i = 0; i < d->PortCount; i++) - if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[i])) + for (int i = 0; i < d->PortCount; i++) { + if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[i])) { d->connect_port(h, i, audio_buffer + a++*BLOCK_SIZE); + } else { + float *x = alloca(sizeof(float)); + *x = 0; + d->connect_port(h, i, x); + } + } mirand = time(NULL); for (int i = 0; i < audio_count*BLOCK_SIZE; i++)