Applied Roumen Petrov patch to fix crash/memory leak
authorPhilip Gladstone <philipjsg@users.sourceforge.net>
Sat, 12 Apr 2003 02:27:54 +0000 (02:27 +0000)
committerPhilip Gladstone <philipjsg@users.sourceforge.net>
Sat, 12 Apr 2003 02:27:54 +0000 (02:27 +0000)
Originally committed as revision 1758 to svn://svn.ffmpeg.org/ffmpeg/trunk

ffserver.c

index ceca3df..5f5b374 100644 (file)
@@ -748,9 +748,6 @@ static void close_connection(HTTPContext *c)
 
     ctx = &c->fmt_ctx;
 
-    for(i=0; i<ctx->nb_streams; i++) 
-        av_free(ctx->streams[i]) ; 
-
     if (!c->last_packet_sent) {
         if (ctx->oformat) {
             /* prepare header */
@@ -761,6 +758,9 @@ static void close_connection(HTTPContext *c)
         }
     }
 
+    for(i=0; i<ctx->nb_streams; i++) 
+        av_free(ctx->streams[i]) ; 
+
     if (c->stream)
         current_bandwidth -= c->stream->bandwidth;
     av_freep(&c->pb_buffer);