[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-commit] /srv/bzr/gnash/trunk r12296: Fix huge memory leak in
From: |
Markus Gothe |
Subject: |
Re: [Gnash-commit] /srv/bzr/gnash/trunk r12296: Fix huge memory leak in ffmpeg audio decoder, as well as some typos that |
Date: |
Mon, 12 Jul 2010 20:00:05 +0200 |
Nice catch!
On 12 Jul 2010, at 10:34, Benjamin Wolsey wrote:
> ------------------------------------------------------------
> revno: 12296 [merge]
> committer: Benjamin Wolsey <address@hidden>
> branch nick: trunk
> timestamp: Mon 2010-07-12 10:34:58 +0200
> message:
> Fix huge memory leak in ffmpeg audio decoder, as well as some typos that
> would lead to the wrong deallocation function being called.
> modified:
> libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
> === modified file 'libmedia/ffmpeg/AudioDecoderFfmpeg.cpp'
> --- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 2010-01-22 00:23:59 +0000
> +++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 2010-07-12 06:58:41 +0000
> @@ -523,10 +523,7 @@
>
> assert(inputSize);
>
> - //static const unsigned int bufsize =
> - //(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2;
> -
> - static const unsigned int bufsize = AVCODEC_MAX_AUDIO_FRAME_SIZE;
> + const size_t bufsize = AVCODEC_MAX_AUDIO_FRAME_SIZE;
>
> // TODO: make this a private member, to reuse (see NetStreamFfmpeg in
> 0.8.3)
> boost::uint8_t* output;
> @@ -575,7 +572,7 @@
> "ffmpeg/libavcodec might fix this issue."), tmp);
> outputSize = 0;
>
> - if (output)
> + if (NEEDS_ALIGNED_MEMORY)
> av_free(output);
> else
> delete [] output;
> @@ -589,7 +586,7 @@
> outputSize, inputSize);
> outputSize = 0;
>
> - if (output)
> + if (NEEDS_ALIGNED_MEMORY)
> av_free(output);
> else
> delete [] output;
> @@ -669,6 +666,7 @@
> boost::uint8_t* newOutput = new boost::uint8_t[outSize];
> memcpy(newOutput, output, outSize);
> outPtr = reinterpret_cast<boost::int16_t*>(newOutput);
> + av_free(output);
> }
>
> outputSize = outSize;
>
> _______________________________________________
> Gnash-commit mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnash-commit
//Markus - The panama-hat hacker