From 9394e66cbceb75f1f29c62224ced948d62ffda94 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 25 Nov 2013 14:01:59 +0100 Subject: [PATCH] ffmpeg plugin: don't crash sniffing unknown files. The Open method can fail and leave the StreamBase object without an IOContext, but the destructor tried to dereference it anyway. This fixes APlayer crashing on many files instead of skipping them. --- src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp index 7531060629..b10b62bab5 100644 --- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp +++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp @@ -242,7 +242,8 @@ StreamBase::~StreamBase() avformat_close_input(&fContext); av_free_packet(&fPacket); av_free(fContext); - av_free(fIOContext->buffer); + if(fIOContext) + av_free(fIOContext->buffer); av_free(fIOContext); }