gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r12296: Fix huge memory leak in ffmp


From: Benjamin Wolsey
Subject: [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 10:34:58 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]