shithub: aubio

Download patch

ref: b1f723d9cc3647f61a19a2d6413445f6151d6d05
parent: 5cf415f92b76a68cf282426ab69502f2cd029901
author: Paul Brossier <piem@altern.org>
date: Tue Aug 9 19:43:39 EDT 2005

fix segfault when file not found

--- a/examples/utils.c
+++ b/examples/utils.c
@@ -210,7 +210,7 @@
 void examples_common_init(int argc,char ** argv) {
 
 
-  aubio_sndfile_t * onsetfile;
+  aubio_sndfile_t * onsetfile = NULL;
   /* parse command line arguments */
   parse_args(argc, argv);
 
@@ -219,6 +219,8 @@
           (onsetfile = new_aubio_sndfile_ro(onset_filename)) ||
                   (onsetfile = new_aubio_sndfile_ro("sounds/woodblock.aiff")) ||
                   (onsetfile = new_aubio_sndfile_ro("../sounds/woodblock.aiff"));
+  }
+  if (onsetfile) {
           /* read the output sound once */
           aubio_sndfile_read(onsetfile, overlap_size, woodblock);
   }