mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
mxfenc: fix memleaks in mxf_write_footer
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Reviewed-by: tomas.hardin@codemill.se Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
5be04f9789
commit
39ddda12f1
@ -2400,7 +2400,7 @@ static int mxf_write_footer(AVFormatContext *s)
|
|||||||
{
|
{
|
||||||
MXFContext *mxf = s->priv_data;
|
MXFContext *mxf = s->priv_data;
|
||||||
AVIOContext *pb = s->pb;
|
AVIOContext *pb = s->pb;
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;
|
mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;
|
||||||
|
|
||||||
@ -2408,10 +2408,10 @@ static int mxf_write_footer(AVFormatContext *s)
|
|||||||
mxf->footer_partition_offset = avio_tell(pb);
|
mxf->footer_partition_offset = avio_tell(pb);
|
||||||
if (mxf->edit_unit_byte_count && s->oformat != &ff_mxf_opatom_muxer) { // no need to repeat index
|
if (mxf->edit_unit_byte_count && s->oformat != &ff_mxf_opatom_muxer) { // no need to repeat index
|
||||||
if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, 0)) < 0)
|
if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, 0)) < 0)
|
||||||
return err;
|
goto end;
|
||||||
} else {
|
} else {
|
||||||
if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, 0)) < 0)
|
if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, 0)) < 0)
|
||||||
return err;
|
goto end;
|
||||||
mxf_write_klv_fill(s);
|
mxf_write_klv_fill(s);
|
||||||
mxf_write_index_table_segment(s);
|
mxf_write_index_table_segment(s);
|
||||||
}
|
}
|
||||||
@ -2424,21 +2424,22 @@ static int mxf_write_footer(AVFormatContext *s)
|
|||||||
/* rewrite body partition to update lengths */
|
/* rewrite body partition to update lengths */
|
||||||
avio_seek(pb, mxf->body_partition_offset[0], SEEK_SET);
|
avio_seek(pb, mxf->body_partition_offset[0], SEEK_SET);
|
||||||
if ((err = mxf_write_opatom_body_partition(s)) < 0)
|
if ((err = mxf_write_opatom_body_partition(s)) < 0)
|
||||||
return err;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
avio_seek(pb, 0, SEEK_SET);
|
avio_seek(pb, 0, SEEK_SET);
|
||||||
if (mxf->edit_unit_byte_count && s->oformat != &ff_mxf_opatom_muxer) {
|
if (mxf->edit_unit_byte_count && s->oformat != &ff_mxf_opatom_muxer) {
|
||||||
if ((err = mxf_write_partition(s, 1, 2, header_closed_partition_key, 1)) < 0)
|
if ((err = mxf_write_partition(s, 1, 2, header_closed_partition_key, 1)) < 0)
|
||||||
return err;
|
goto end;
|
||||||
mxf_write_klv_fill(s);
|
mxf_write_klv_fill(s);
|
||||||
mxf_write_index_table_segment(s);
|
mxf_write_index_table_segment(s);
|
||||||
} else {
|
} else {
|
||||||
if ((err = mxf_write_partition(s, 0, 0, header_closed_partition_key, 1)) < 0)
|
if ((err = mxf_write_partition(s, 0, 0, header_closed_partition_key, 1)) < 0)
|
||||||
return err;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
ff_audio_interleave_close(s);
|
ff_audio_interleave_close(s);
|
||||||
|
|
||||||
av_freep(&mxf->index_entries);
|
av_freep(&mxf->index_entries);
|
||||||
@ -2448,7 +2449,7 @@ static int mxf_write_footer(AVFormatContext *s)
|
|||||||
|
|
||||||
mxf_free(s);
|
mxf_free(s);
|
||||||
|
|
||||||
return 0;
|
return err < 0 ? err : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
|
static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user