mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 10:00:08 +01:00
avformat/segment: Remove redundant code for freeing in write_trailer
This code mostly duplicates code in the deinit function; the only exception is av_opt_free(): The options are freed generically lateron. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
@@ -981,30 +981,21 @@ static int seg_write_trailer(struct AVFormatContext *s)
|
|||||||
{
|
{
|
||||||
SegmentContext *seg = s->priv_data;
|
SegmentContext *seg = s->priv_data;
|
||||||
AVFormatContext *oc = seg->avf;
|
AVFormatContext *oc = seg->avf;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (!oc)
|
if (!oc)
|
||||||
goto fail;
|
return 0;
|
||||||
|
|
||||||
if (!seg->write_header_trailer) {
|
if (!seg->write_header_trailer) {
|
||||||
if ((ret = segment_end(s, 0, 1)) < 0)
|
if ((ret = segment_end(s, 0, 1)) < 0)
|
||||||
goto fail;
|
return ret;
|
||||||
if ((ret = open_null_ctx(&oc->pb)) < 0)
|
if ((ret = open_null_ctx(&oc->pb)) < 0)
|
||||||
goto fail;
|
return ret;
|
||||||
seg->is_nullctx = 1;
|
seg->is_nullctx = 1;
|
||||||
ret = av_write_trailer(oc);
|
ret = av_write_trailer(oc);
|
||||||
close_null_ctxp(&oc->pb);
|
|
||||||
} else {
|
} else {
|
||||||
ret = segment_end(s, 1, 1);
|
ret = segment_end(s, 1, 1);
|
||||||
}
|
}
|
||||||
fail:
|
|
||||||
if (seg->list)
|
|
||||||
ff_format_io_close(s, &seg->list_pb);
|
|
||||||
|
|
||||||
av_opt_free(seg);
|
|
||||||
|
|
||||||
avformat_free_context(oc);
|
|
||||||
seg->avf = NULL;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user