ffserver deallocate ctx->streams on closing patch by (Mark Hills <mark at pogo dot org dot uk>)

Originally committed as revision 1704 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Mark Hills 22 years ago committed by Michael Niedermayer
parent 06219cb194
commit b88ba82315
  1. 6
      ffserver.c
  2. 9
      libavformat/aviobuf.c

@ -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) { if (!c->last_packet_sent) {
ctx = &c->fmt_ctx;
if (ctx->oformat) { if (ctx->oformat) {
/* prepare header */ /* prepare header */
if (url_open_dyn_buf(&ctx->pb) >= 0) { if (url_open_dyn_buf(&ctx->pb) >= 0) {

@ -569,12 +569,9 @@ static void dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
} }
if (new_allocated_size > d->allocated_size) { if (new_allocated_size > d->allocated_size) {
new_buffer = av_malloc(new_allocated_size); d->buffer = av_realloc(d->buffer, new_allocated_size);
if (!new_buffer) if(d->buffer == NULL)
return; return ;
memcpy(new_buffer, d->buffer, d->size);
av_free(d->buffer);
d->buffer = new_buffer;
d->allocated_size = new_allocated_size; d->allocated_size = new_allocated_size;
} }
memcpy(d->buffer + d->pos, buf, buf_size); memcpy(d->buffer + d->pos, buf, buf_size);

Loading…
Cancel
Save