src/io/source_avcodec.c: simplify new_ failure recovery
authorPaul Brossier <piem@piem.org>
Fri, 17 Mar 2017 17:29:12 +0000 (18:29 +0100)
committerPaul Brossier <piem@piem.org>
Fri, 17 Mar 2017 17:29:12 +0000 (18:29 +0100)
src/io/source_avcodec.c

index 91bb007..7064314 100644 (file)
@@ -163,7 +163,7 @@ aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path, uint_t sa
     char errorstr[256];
     av_strerror (err, errorstr, sizeof(errorstr));
     AUBIO_ERR("source_avcodec: Failed opening %s (%s)\n", s->path, errorstr);
-    goto beach_streamopts;
+    goto beach;
   }
 
   // try to make sure max_analyze_duration is big enough for most songs
@@ -298,9 +298,8 @@ aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path, uint_t sa
   av_dict_free(&streamopts);
   return s;
 
-beach_streamopts:
-  av_dict_free(&streamopts);
 beach:
+  if (streamopts != 0) av_dict_free(&streamopts);
   //AUBIO_ERR("can not read %s at samplerate %dHz with a hop_size of %d\n",
   //    s->path, s->samplerate, s->hop_size);
 #ifdef HAVE_AUBIO_AVCODEC_MUTEX