From 0256bbbbafa34fde308ca4befc1a9b99ec07f568 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 13 Mar 2019 00:27:03 +0100
Subject: [PATCH] decoder/ffmpeg: wider try/catch in ffmpeg_scan_stream()

---
 src/decoder/plugins/FfmpegDecoderPlugin.cxx | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
index 967ae605e..b15aab225 100644
--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
@@ -678,23 +678,19 @@ FfmpegScanStream(AVFormatContext &format_context,
 
 static bool
 ffmpeg_scan_stream(InputStream &is, TagHandler &handler) noexcept
-{
+try {
 	AvioStream stream(nullptr, is);
 	if (!stream.Open())
 		return false;
 
-	AVFormatContext *f;
-	try {
-		f = FfmpegOpenInput(stream.io, is.GetURI(), nullptr);
-	} catch (...) {
-		return false;
-	}
-
+	AVFormatContext *f = FfmpegOpenInput(stream.io, is.GetURI(), nullptr);
 	AtScopeExit(&f) {
 		avformat_close_input(&f);
 	};
 
 	return FfmpegScanStream(*f, handler);
+} catch (...) {
+	return false;
 }
 
 /**