From 78a7af823b7c2a1e3184e6680f2b49bf67101e5c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 1 Sep 2017 02:16:33 -0300 Subject: Use the new AVIOContext destructor. (cherry picked from commit 6f554521afdf7ab4edbfaa9536660a1dca946b19) Signed-off-by: James Almer --- libavformat/avidec.c | 2 +- libavformat/flac_picture.c | 4 ++-- libavformat/hdsenc.c | 2 +- libavformat/mpjpegdec.c | 2 +- libavformat/rdt.c | 2 +- libavformat/segment.c | 2 +- libavformat/smoothstreamingenc.c | 2 +- libavformat/swfdec.c | 2 +- libavformat/tests/movenc.c | 2 +- libavformat/wtvdec.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 9816a1dfac..b8a31dcff2 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1124,7 +1124,7 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt) error: av_freep(&ast->sub_ctx); - av_freep(&pb); + avio_context_free(&pb); } return 0; } diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c index a3217f02a6..38982b960d 100644 --- a/libavformat/flac_picture.c +++ b/libavformat/flac_picture.c @@ -140,14 +140,14 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) if (desc) av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL); - av_freep(&pb); + avio_context_free(&pb); return 0; fail: av_buffer_unref(&data); av_freep(&desc); - av_freep(&pb); + avio_context_free(&pb); return ret; } diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index d01b5fa84e..72829f7257 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -145,7 +145,7 @@ static void hds_free(AVFormatContext *s) if (os->ctx && os->ctx_inited) av_write_trailer(os->ctx); if (os->ctx) - av_freep(&os->ctx->pb); + avio_context_free(&os->ctx->pb); if (os->ctx) avformat_free_context(os->ctx); av_freep(&os->metadata); diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c index 4c7764412f..83aa70d0c9 100644 --- a/libavformat/mpjpegdec.c +++ b/libavformat/mpjpegdec.c @@ -126,7 +126,7 @@ static int mpjpeg_read_probe(AVProbeData *p) ret = (parse_multipart_header(pb, &size, "--", NULL) >= 0) ? AVPROBE_SCORE_MAX : 0; - av_free(pb); + avio_context_free(&pb); return ret; } diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 8670eadce6..b69827fcbf 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -323,7 +323,7 @@ get_cache: st, rdt->rmst[st->index], pkt); if (rdt->audio_pkt_cnt == 0 && st->codecpar->codec_id == AV_CODEC_ID_AAC) - av_freep(&rdt->rmctx->pb); + avio_context_free(&rdt->rmctx->pb); } pkt->stream_index = st->index; pkt->pts = *timestamp; diff --git a/libavformat/segment.c b/libavformat/segment.c index 0e8bcddb00..b0ef6dd38e 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -569,7 +569,7 @@ static int open_null_ctx(AVIOContext **ctx) static void close_null_ctxp(AVIOContext **pb) { av_freep(&(*pb)->buffer); - av_freep(pb); + avio_context_free(pb); } static int select_reference_stream(AVFormatContext *s) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 083af49212..86618351b8 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -182,7 +182,7 @@ static void ism_free(AVFormatContext *s) if (os->ctx && os->ctx_inited) av_write_trailer(os->ctx); if (os->ctx && os->ctx->pb) - av_freep(&os->ctx->pb); + avio_context_free(&os->ctx->pb); if (os->ctx) avformat_free_context(os->ctx); av_freep(&os->private_str); diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index b91560c56c..57b619fb20 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -531,7 +531,7 @@ static av_cold int swf_read_close(AVFormatContext *avctx) inflateEnd(&s->zstream); av_freep(&s->zbuf_in); av_freep(&s->zbuf_out); - av_freep(&s->zpb); + avio_context_free(&s->zpb); return 0; } #endif diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c index ab871765d9..7a66395efd 100644 --- a/libavformat/tests/movenc.c +++ b/libavformat/tests/movenc.c @@ -344,7 +344,7 @@ static void signal_init_ts(void) static void finish(void) { av_write_trailer(ctx); - av_free(ctx->pb); + avio_context_free(&ctx->pb); avformat_free_context(ctx); ctx = NULL; } diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 3ac4501306..27be5c9c04 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -305,7 +305,7 @@ static void wtvfile_close(AVIOContext *pb) av_freep(&wf->sectors); av_freep(&pb->opaque); av_freep(&pb->buffer); - av_free(pb); + avio_context_free(&pb); } /* -- cgit v1.2.3