[FFmpeg-cvslog] libavfilter/af_channelmap: avoid derreferencing possible null

Reynaldo H. Verdejo Pinochet git at videolan.org
Fri Sep 26 23:54:25 CEST 2014


ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com> | Fri Sep 26 13:58:22 2014 -0300| [32288234a200f69e1638c7d6e0129d5353e333a3] | committer: Reynaldo H. Verdejo Pinochet

libavfilter/af_channelmap: avoid derreferencing possible null

ff_all_channel_layouts() might return null on alloc failure.

Fixes CID1241517

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32288234a200f69e1638c7d6e0129d5353e333a3
---

 libavfilter/af_channelmap.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index 0bf2fe9..c3454c5 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -287,10 +287,16 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
 static int channelmap_query_formats(AVFilterContext *ctx)
 {
     ChannelMapContext *s = ctx->priv;
+    AVFilterChannelLayouts *layouts;
 
     ff_set_common_formats(ctx, ff_planar_sample_fmts());
     ff_set_common_samplerates(ctx, ff_all_samplerates());
-    ff_channel_layouts_ref(ff_all_channel_layouts(), &ctx->inputs[0]->out_channel_layouts);
+
+    layouts = ff_all_channel_layouts();
+    if (!layouts)
+        return AVERROR(ENOMEM);
+
+    ff_channel_layouts_ref(layouts, &ctx->inputs[0]->out_channel_layouts);
     ff_channel_layouts_ref(s->channel_layouts,       &ctx->outputs[0]->in_channel_layouts);
 
     return 0;



More information about the ffmpeg-cvslog mailing list