[haiku-commits] Re: haiku: hrev52272 - src/add-ons/media/plugins/ffmpeg

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 24 Aug 2018 14:11:44 +0200

Hi,

Am 24.08.2018 um 10:22 schrieb Stefano Ceccherini:

diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp 
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
index f15c7437f2..c289f59bf1 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
@@ -148,7 +148,7 @@ AVCodecDecoder::~AVCodecDecoder()
  #endif
if (fCodecInitDone)
-               avcodec_close(fCodecContext);
+               avcodec_free_context(&fCodecContext);
swr_free(&fResampleContext);
        free(fChunkBuffer);
@@ -158,7 +158,6 @@ AVCodecDecoder::~AVCodecDecoder()
        av_free(fRawDecodedPicture);
        av_free(fRawDecodedAudio->opaque);
        av_free(fRawDecodedAudio);
-       avcodec_free_context(&fCodecContext);
        av_free(fDecodedDataBuffer);

What happens in case fCodecInitDone is "false"? Will fCodecContext now be leaked in some code paths? I was wondering when you changed the original code, which had "av_free(fCodecContext);" I am usually very careful with these things and probably looked up what avcodec_free_context() actually does, but I don't remember now. Did you have a reason for changing this code in the first place?

Best regards,
-Stephan

Other related posts: