[Ffmpeg-devel] [PATCH] two memory leak fix

Michael Niedermayer michaelni
Mon Mar 5 22:12:24 CET 2007


Hi

On Mon, Mar 05, 2007 at 08:46:49PM +0800, Limin Wang wrote:
> Hi,
> 
> This patch fixes 2 memory leaks in ffmpeg.c, please review it
> and see whether it's ok.
> 
> 
> Thanks,
> Limin
> 

> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 8245)
> +++ ffmpeg.c	(working copy)
> @@ -1330,6 +1330,7 @@
>                  }
>              }
>          }
> +        av_freep(&samples);
>      }

rejected 
this array as well as the other are never allocated more then once and thus
are not leaks the memory will be freed when ffmeg exists with or
without the av_free() furthermore freeing samples wthout updating the related
variables puts the code into an inconsistant state that is samples_size
just isnt correct anymore this could lead to problems so considering that
this change has no advantage but a possible problem i wont accept it ...


>  
>      return 0;
> @@ -3812,7 +3813,8 @@
>          av_free(intra_matrix);
>      if(inter_matrix)
>          av_free(inter_matrix);
> -
> +    if(opt_names)
> +        av_free(opt_names);

applied without the if()

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070305/e996da4d/attachment.pgp>



More information about the ffmpeg-devel mailing list