1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-07-11 14:30:22 +02:00

move free() of AVStream priv data to av_write_trailer()

Originally committed as revision 3548 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer
2004-10-01 16:30:15 +00:00
parent 95f97de146
commit c40a3a42e1
3 changed files with 6 additions and 8 deletions

View File

@ -278,8 +278,6 @@ static int ffm_write_trailer(AVFormatContext *s)
put_flush_packet(pb); put_flush_packet(pb);
} }
for(i=0;i<s->nb_streams;i++)
av_freep(&s->streams[i]->priv_data);
return 0; return 0;
} }
#endif //CONFIG_ENCODERS #endif //CONFIG_ENCODERS

View File

@ -1012,9 +1012,6 @@ static int mpeg_mux_end(AVFormatContext *ctx)
//put_be32(&ctx->pb, ISO_11172_END_CODE); //put_be32(&ctx->pb, ISO_11172_END_CODE);
//put_flush_packet(&ctx->pb); //put_flush_packet(&ctx->pb);
for(i=0;i<ctx->nb_streams;i++)
av_freep(&ctx->streams[i]->priv_data);
return 0; return 0;
} }
#endif //CONFIG_ENCODERS #endif //CONFIG_ENCODERS

View File

@ -2094,13 +2094,13 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
* @return 0 if OK. AVERROR_xxx if error. */ * @return 0 if OK. AVERROR_xxx if error. */
int av_write_trailer(AVFormatContext *s) int av_write_trailer(AVFormatContext *s)
{ {
int ret; int ret, i;
for(;;){ for(;;){
AVPacket pkt; AVPacket pkt;
ret= av_interleave_packet(s, &pkt, NULL, 1); ret= av_interleave_packet(s, &pkt, NULL, 1);
if(ret<0) //FIXME cleanup needed for ret<0 ? if(ret<0) //FIXME cleanup needed for ret<0 ?
return ret; goto fail;
if(!ret) if(!ret)
break; break;
@ -2110,10 +2110,13 @@ int av_write_trailer(AVFormatContext *s)
av_free_packet(&pkt); av_free_packet(&pkt);
if(ret<0) if(ret<0)
return ret; goto fail;
} }
ret = s->oformat->write_trailer(s); ret = s->oformat->write_trailer(s);
fail:
for(i=0;i<s->nb_streams;i++)
av_freep(&s->streams[i]->priv_data);
av_freep(&s->priv_data); av_freep(&s->priv_data);
return ret; return ret;
} }