Use the new AVIOContext destructor.

This commit is contained in:
Anton Khirnov
2017-01-13 12:04:16 +01:00
parent 99684f3ae7
commit 6f554521af
11 changed files with 21 additions and 19 deletions

View File

@@ -184,10 +184,10 @@ static int open_null_ctx(AVIOContext **ctx)
return 0;
}
static void close_null_ctx(AVIOContext *pb)
static void close_null_ctx(AVIOContext **pb)
{
av_free(pb->buffer);
av_free(pb);
av_free((*pb)->buffer);
avio_context_free(pb);
}
static void seg_free_context(SegmentContext *seg)
@@ -259,7 +259,7 @@ static int seg_write_header(AVFormatContext *s)
}
if (!seg->write_header_trailer) {
close_null_ctx(oc->pb);
close_null_ctx(&oc->pb);
if ((ret = s->io_open(s, &oc->pb, oc->filename, AVIO_FLAG_WRITE, NULL)) < 0)
goto fail;
}
@@ -353,7 +353,7 @@ static int seg_write_trailer(struct AVFormatContext *s)
if ((ret = open_null_ctx(&oc->pb)) < 0)
goto fail;
ret = av_write_trailer(oc);
close_null_ctx(oc->pb);
close_null_ctx(&oc->pb);
} else {
ret = segment_end(oc, 1);
}