[FFmpeg-devel] [PATCH 2/2] ffserver: fix streams memleak when closing a connection.

Clément Bœsch ubitux at gmail.com
Thu Nov 15 11:53:08 CET 2012


On Thu, Nov 15, 2012 at 11:48:22AM +0100, Michael Niedermayer wrote:
> On Thu, Nov 15, 2012 at 09:42:21AM +0100, Clément Bœsch wrote:
> > On Wed, Nov 14, 2012 at 05:18:45PM +0100, Michael Niedermayer wrote:
> > > On Tue, Nov 13, 2012 at 04:35:18PM +0100, Clément Bœsch wrote:
> > > > From: Clément Bœsch <clement.boesch at smartjog.com>
> > > > 
> > > > ---
> > > >  ffserver.c |    1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/ffserver.c b/ffserver.c
> > > > index 0d2a8a7..28a614f 100644
> > > > --- a/ffserver.c
> > > > +++ b/ffserver.c
> > > > @@ -929,6 +929,7 @@ static void close_connection(HTTPContext *c)
> > > >  
> > > >      for(i=0; i<ctx->nb_streams; i++)
> > > >          av_free(ctx->streams[i]);
> > > > +    av_free(ctx->streams);
> > > 
> > > should be av_freep()
> > > 
> > 
> > Well, a few lines below the whole context is completely destroyed so it
> > doesn't really matter, but changed anyway since it doesn't hurt either.
> > 
> > Also note that this isn't enough to fix the leak: adding a
> > av_free(ctx->priv_data) fixes the real problem. Both streams and priv_data
> > are locally allocated, the rest of the structure is shared between the
> > connections so we can't use avformat_free_context() or similar.
> > 
> > New patch attached.
> > 
> > -- 
> > Clément B.
> 
> >  ffserver.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 1724952ddd4c928d7bb09278c5453a019a063e21  0001-ffserver-fix-streams-and-priv_data-memleaks-when-clo.patch
> > From 93df34bcc708ab17fcd2da231e63ac51bdb2c1b2 Mon Sep 17 00:00:00 2001
> > From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <clement.boesch at smartjog.com>
> > Date: Tue, 13 Nov 2012 17:32:35 +0200
> > Subject: [PATCH] ffserver: fix streams and priv_data memleaks when closing a
> >  connection.
> 
> LGTM, thanks
> 

Applied.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121115/5a97e907/attachment.asc>


More information about the ffmpeg-devel mailing list