avfilter/aresample: Check for memory alloc failure for out sample rates
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Thu, 2 Oct 2014 10:55:51 +0000 (11:55 +0100)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Thu, 2 Oct 2014 11:22:37 +0000 (12:22 +0100)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavfilter/af_aresample.c

index 5f34321..8a8b386 100644 (file)
@@ -103,6 +103,11 @@ static int query_formats(AVFilterContext *ctx)
     } else {
         out_samplerates = ff_all_samplerates();
     }
     } else {
         out_samplerates = ff_all_samplerates();
     }
+    if (!out_samplerates) {
+        av_log(ctx, AV_LOG_ERROR, "Cannot allocate output samplerates.\n");
+        return AVERROR(ENOMEM);
+    }
+
     ff_formats_ref(out_samplerates, &outlink->in_samplerates);
 
     if(out_format != AV_SAMPLE_FMT_NONE) {
     ff_formats_ref(out_samplerates, &outlink->in_samplerates);
 
     if(out_format != AV_SAMPLE_FMT_NONE) {