# HG changeset patch # User michael # Date 1096648215 0 # Node ID 26a477a5ebda51e37bec49f8e09845d7ed6a8e92 # Parent 78a8cbdad2697c791120e8d2c869777352fcd2d5 move free() of AVStream priv data to av_write_trailer() diff -r 78a8cbdad269 -r 26a477a5ebda ffm.c --- a/ffm.c Fri Oct 01 16:00:00 2004 +0000 +++ b/ffm.c Fri Oct 01 16:30:15 2004 +0000 @@ -278,8 +278,6 @@ put_flush_packet(pb); } - for(i=0;inb_streams;i++) - av_freep(&s->streams[i]->priv_data); return 0; } #endif //CONFIG_ENCODERS diff -r 78a8cbdad269 -r 26a477a5ebda mpeg.c --- a/mpeg.c Fri Oct 01 16:00:00 2004 +0000 +++ b/mpeg.c Fri Oct 01 16:30:15 2004 +0000 @@ -1012,9 +1012,6 @@ //put_be32(&ctx->pb, ISO_11172_END_CODE); //put_flush_packet(&ctx->pb); - for(i=0;inb_streams;i++) - av_freep(&ctx->streams[i]->priv_data); - return 0; } #endif //CONFIG_ENCODERS diff -r 78a8cbdad269 -r 26a477a5ebda utils.c --- a/utils.c Fri Oct 01 16:00:00 2004 +0000 +++ b/utils.c Fri Oct 01 16:30:15 2004 +0000 @@ -2094,13 +2094,13 @@ * @return 0 if OK. AVERROR_xxx if error. */ int av_write_trailer(AVFormatContext *s) { - int ret; + int ret, i; for(;;){ AVPacket pkt; ret= av_interleave_packet(s, &pkt, NULL, 1); if(ret<0) //FIXME cleanup needed for ret<0 ? - return ret; + goto fail; if(!ret) break; @@ -2110,10 +2110,13 @@ av_free_packet(&pkt); if(ret<0) - return ret; + goto fail; } ret = s->oformat->write_trailer(s); +fail: + for(i=0;inb_streams;i++) + av_freep(&s->streams[i]->priv_data); av_freep(&s->priv_data); return ret; }