[FFmpeg-devel] [PATCH] fix memleak in packet corrupt dropping code

Michael Niedermayer michaelni at gmx.at
Tue Oct 18 00:10:08 CEST 2011


On Mon, Oct 17, 2011 at 10:33:13AM -0500, Chris Kennedy wrote:
> 
> There is a memleak in the packet dropping method used when
> packets are corrupt, this patch fixes it.  Valgrind shows
> it nice after this change, otherwise it leaks...
[...]
>  utils.c |    3 +++
>  1 file changed, 3 insertions(+)
> 51242e3cbef916224f68d1ce908a14a65d834d89  corrupt_packet_memleak.diff
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index c7eb93f..849dbce 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -756,6 +756,9 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
>              av_log(s, AV_LOG_WARNING,
>                     "Dropped corrupted packet (stream = %d)\n",
>                     pkt->stream_index);
> +            if(!(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
> +                av_packet_merge_side_data(pkt);
> +           av_free_packet(pkt);
>              continue;

why do you call  av_packet_merge_side_data() before ?
that should not be needed

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111018/6a8dac75/attachment.asc>


More information about the ffmpeg-devel mailing list