]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
ffserver deallocate ctx->streams on closing patch by (Mark Hills <mark at pogo dot...
authormichaelni <michaelni@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 26 Mar 2003 10:30:08 +0000 (10:30 +0000)
committermichaelni <michaelni@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 26 Mar 2003 10:30:08 +0000 (10:30 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1704 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

ffserver.c
libavformat/aviobuf.c

index 73e61e5a53aac6c29d643797b9f092119c1235b8..173ae8457b8a1780cd0f0a85704101b0ae5570ca 100644 (file)
@@ -744,8 +744,12 @@ 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) {
-        ctx = &c->fmt_ctx;
         if (ctx->oformat) {
             /* prepare header */
             if (url_open_dyn_buf(&ctx->pb) >= 0) {
index fc1ae2c64f4862518e8bb1416a3e29a05376f646..11d00f239d57a528638890a9121ed4455c5a6382 100644 (file)
@@ -569,12 +569,9 @@ static void dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
     }
     
     if (new_allocated_size > d->allocated_size) {
-        new_buffer = av_malloc(new_allocated_size);
-        if (!new_buffer)
-            return;
-        memcpy(new_buffer, d->buffer, d->size);
-        av_free(d->buffer);
-        d->buffer = new_buffer;
+        d->buffer = av_realloc(d->buffer, new_allocated_size);
+        if(d->buffer == NULL)
+             return ;
         d->allocated_size = new_allocated_size;
     }
     memcpy(d->buffer + d->pos, buf, buf_size);