[sink_wavwrite] check fseek and fwrite return values
[aubio.git] / src / io / source.c
index 246eb90..5a2e493 100644 (file)
@@ -18,7 +18,6 @@
 
 */
 
-#include "config.h"
 #include "aubio_priv.h"
 #include "fvec.h"
 #include "fmat.h"
@@ -115,9 +114,14 @@ aubio_source_t * new_aubio_source(const char_t * uri, uint_t samplerate, uint_t
     return s;
   }
 #endif /* HAVE_WAVREAD */
-  AUBIO_ERROR("source: failed creating aubio source with %s"
-     " at samplerate %d with hop_size %d\n", uri, samplerate, hop_size);
-  AUBIO_FREE(s);
+#if !defined(HAVE_WAVREAD) && \
+  !defined(HAVE_LIBAV) && \
+  !defined(HAVE_SOURCE_APPLE_AUDIO) && \
+  !defined(HAVE_SNDFILE)
+  AUBIO_ERROR("source: failed creating with %s at %dHz with hop size %d"
+     " (no source built-in)\n", uri, samplerate, hop_size);
+#endif
+  del_aubio_source(s);
   return NULL;
 }
 
@@ -134,8 +138,9 @@ uint_t aubio_source_close(aubio_source_t * s) {
 }
 
 void del_aubio_source(aubio_source_t * s) {
-  if (!s) return;
-  s->s_del((void *)s->source);
+  AUBIO_ASSERT(s);
+  if (s->s_del && s->source)
+    s->s_del((void *)s->source);
   AUBIO_FREE(s);
 }