[FFmpeg-devel] mpegts memory leak

Uve W. Rick Uve.Rick
Wed Sep 29 22:58:09 CEST 2010



> -----Original Message-----
> From: ffmpeg-devel-bounces at mplayerhq.hu [mailto:ffmpeg-devel-
> bounces at mplayerhq.hu] On Behalf Of M?ns Rullg?rd
> Sent: Wednesday, September 29, 2010 12:48 PM
> To: FFmpeg development discussions and patches
> Subject: Re: [FFmpeg-devel] mpegts memory leak
> 
> "Uve W. Rick" <Uve.Rick at uav.com> writes:
> 
> >> > +                    if (!ts->pkt->data) {
> >> > +                        av_free(ts->pkt->data);
> >> > +                    }
> >>
> >> This doesn't make sense, if ts->pkt->data is NULL there is no point
> >> freeing it.
> >
> > If you look right below where the ts->pkt->data is set to NULL, you
> > have the new_pes_packet this will set the ts->pkt->data.  Then in
> > the line right after the patch, you have another new_pes_packet.  It
> > is possible that both instances of new_pes_packet are called.  In
> > the current implementation, the ts->pkt->data is simply overwritten
> > and the memory from the first call to new_pes_packet is lost.
> 
> How does calling free() on a null pointer help with any of this?
> 

Sorry, I'm use to writing (ts->pkt->data != NULL) instead of just (ts->pkt->data).

New patch.

> --
> M?ns Rullg?rd
> mans at mansr.com
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpegts_leak.patch
Type: application/octet-stream
Size: 1612 bytes
Desc: mpegts_leak.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100929/abf3eae1/attachment.obj>



More information about the ffmpeg-devel mailing list