[Ffmpeg-devel] [PATCH] Fix leak of AVPacket data in ffserver

Christian Iversen chrivers
Tue Jan 24 00:18:21 CET 2006


On Monday 23 January 2006 23:38, Bryan Mayland wrote:
> Bryan Mayland wrote:
> > I was noticing that ffserver memory usage steadily grows over time.
> > There are a couple reasons for this, but here is the big one.  When in
> > the HTTPSTATE_SEND_DATA state, we're basically in a
> > av_read_frame()/av_write_frame() loop.  If the av_write_frame doesn't
> > need a flush (which is the case when writing low bitrate [96kbit] asf
> > streams), nothing is written to the dynbuff and the code loops back to
> > read more frames to fill the outgoing buffer.  In this case however,
> > the data attached to the AVPacket is not freed with a call to
> > av_free_packet.
> > This patch fixes that in the common case as well as in the case a
> > dynbuff could not be allocated.  NOTE:  This patch must be applied
> > *after* my ffserver_warning_clean2.diff patch.
>
>     Dammit.  Helps if I attach the right patch.  This one attached
> correctly fixes both conditions.

--- ffserver.c  12 Jan 2006 22:43:14 -0000      1.104
+++ ffserver.c  23 Jan 2006 22:36:23 -0000
@@ -2169,6 +2175,7 @@
                             ret = url_open_dyn_buf(&ctx->pb);
                         }
                         if (ret < 0) {
+                            av_free_packet(&pkt);
                             /* XXX: potential leak */
                             return -1;
                         }

Is that "XXX: potential leak" connected to the fix you just sent here? In that 
case, I vote for its removal :-)

-- 
Regards,
Christian Iversen





More information about the ffmpeg-devel mailing list