[FFmpeg-devel] [PATCH] ffmpeg.c: Fixed Memory Leak Issue

Chiranjeevi Melam cmelam at rgbnetworks.com
Wed Aug 31 17:05:21 CEST 2011


Hi,
Fixed Memory Leak issue in ffmpeg.c
Thanks,
Chiru

diff --git a/ffmpeg/ffmpeg_orig.c b/ffmpeg/ffmpeg_new.c
index 95b3252..e14ad33 100755
--- a/ffmpeg/ffmpeg_orig.c
+++ b/ffmpeg/ffmpeg_new.c
@@ -251,6 +251,8 @@ static AVBitStreamFilterContext *video_bitstream_filters=NULL;
static AVBitStreamFilterContext *audio_bitstream_filters=NULL;
static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL;

+static uint8_t *input_tmp= NULL;
+
#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"

struct InputStream;
@@ -570,6 +572,7 @@ static int ffmpeg_exit(int ret)
#if CONFIG_AVFILTER
     avfilter_uninit();
#endif
+       av_free(input_tmp);

     if (received_sigterm) {
         fprintf(stderr,
@@ -931,7 +934,6 @@ need_realloc:
                         return;
                    ist->is_start=0;
                 }else{
-                    static uint8_t *input_tmp= NULL;
                     input_tmp= av_realloc(input_tmp, byte_delta + size);

                     if(byte_delta > allocated_for_size - size){


More information about the ffmpeg-devel mailing list