From 3d9f49c2aed349000588b203b4589274eb6b7599 Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Date: Wed, 24 Feb 2016 12:11:33 -0500
Subject: [PATCH] mediadecoder: fix crash on hang up

introduced in 207f0d

avformat_close_input() does all the job and nullptr the given pointer.

Tuleap: #412
Change-Id: I3104d5dd66e3207d535dca332f8c9ce2463373a1
---
 src/media/media_decoder.cpp | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/media/media_decoder.cpp b/src/media/media_decoder.cpp
index c59f71f10a..07e7228140 100644
--- a/src/media/media_decoder.cpp
+++ b/src/media/media_decoder.cpp
@@ -48,17 +48,8 @@ MediaDecoder::~MediaDecoder()
 {
     if (decoderCtx_)
         avcodec_close(decoderCtx_);
-
-    if (inputCtx_) {
-        if (inputCtx_->nb_streams > 0) {
-#if LIBAVFORMAT_VERSION_CHECK(53, 17, 0, 25, 0)
-            avformat_close_input(&inputCtx_);
-#else
-            av_close_input_file(inputCtx_);
-#endif
-        }
-        avformat_free_context(inputCtx_);
-    }
+    if (inputCtx_)
+        avformat_close_input(&inputCtx_);
 
     av_dict_free(&options_);
 }
-- 
GitLab