Unified · Split
| @@ -1178,7 +1178,7 @@ int main(int argc, char **argv) · 1177 unmodified lines | ||
| 1178 | 1178 | ret = probe_file(input_filename); |
| 1179 | 1179 | probe_footer(); |
| 1180 | 1180 | avio_flush(probe_out); |
| 1181 | − av_freep(&probe_out); | |
| 1181 | + avio_context_free(&probe_out); | |
| 1182 | 1182 | av_freep(&buffer); |
| 1183 | 1183 | uninit_opts(); |
| 1184 | 1184 | avformat_network_deinit(); |
| @@ -901,7 +901,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) · 900 unmodified lines | ||
| 901 | 901 | return 1; |
| 902 | 902 | |
| 903 | 903 | error: |
| 904 | − av_freep(&pb); | |
| 904 | + avio_context_free(&pb); | |
| 905 | 905 | } |
| 906 | 906 | return 0; |
| 907 | 907 | } |
| @@ -1576,7 +1576,7 @@ static int avi_read_close(AVFormatContext *s) · 668 unmodified lines | ||
| 1576 | 1576 | AVIStream *ast = st->priv_data; |
| 1577 | 1577 | if (ast) { |
| 1578 | 1578 | if (ast->sub_ctx) { |
| 1579 | − av_freep(&ast->sub_ctx->pb); | |
| 1579 | + avio_context_free(&ast->sub_ctx->pb); | |
| 1580 | 1580 | avformat_close_input(&ast->sub_ctx); |
| 1581 | 1581 | } |
| 1582 | 1582 | av_free(ast->sub_buffer); |
| @@ -139,14 +139,14 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) · 138 unmodified lines | ||
| 139 | 139 | if (desc) |
| 140 | 140 | av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL); |
| 141 | 141 | |
| 142 | − av_freep(&pb); | |
| 142 | + avio_context_free(&pb); | |
| 143 | 143 | |
| 144 | 144 | return 0; |
| 145 | 145 | |
| 146 | 146 | fail: |
| 147 | 147 | av_buffer_unref(&data); |
| 148 | 148 | av_freep(&desc); |
| 149 | − av_freep(&pb); | |
| 149 | + avio_context_free(&pb); | |
| 150 | 150 | |
| 151 | 151 | return ret; |
| 152 | 152 | } |
| @@ -143,8 +143,8 @@ static void hds_free(AVFormatContext *s) · 142 unmodified lines | ||
| 143 | 143 | ff_format_io_close(s, &os->out); |
| 144 | 144 | if (os->ctx && os->ctx_inited) |
| 145 | 145 | av_write_trailer(os->ctx); |
| 146 | − if (os->ctx && os->ctx->pb) | |
| 147 | − av_free(os->ctx->pb); | |
| 146 | + if (os->ctx) | |
| 147 | + avio_context_free(&os->ctx->pb); | |
| 148 | 148 | if (os->ctx) |
| 149 | 149 | avformat_free_context(os->ctx); |
| 150 | 150 | av_free(os->metadata); |
| @@ -102,7 +102,7 @@ static int mpjpeg_read_probe(AVProbeData *p) · 101 unmodified lines | ||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | − av_free(pb); | |
| 105 | + avio_context_free(&pb); | |
| 106 | 106 | |
| 107 | 107 | return ret; |
| 108 | 108 | } |
| @@ -324,7 +324,7 @@ get_cache: · 323 unmodified lines | ||
| 324 | 324 | st, rdt->rmst[st->index], pkt); |
| 325 | 325 | if (rdt->audio_pkt_cnt == 0 && |
| 326 | 326 | st->codecpar->codec_id == AV_CODEC_ID_AAC) |
| 327 | − av_freep(&rdt->rmctx->pb); | |
| 327 | + avio_context_free(&rdt->rmctx->pb); | |
| 328 | 328 | } |
| 329 | 329 | pkt->stream_index = st->index; |
| 330 | 330 | pkt->pts = *timestamp; |
| @@ -184,10 +184,10 @@ static int open_null_ctx(AVIOContext **ctx) · 183 unmodified lines | ||
| 184 | 184 | return 0; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | −static void close_null_ctx(AVIOContext *pb) | |
| 187 | +static void close_null_ctx(AVIOContext **pb) | |
| 188 | 188 | { |
| 189 | − av_free(pb->buffer); | |
| 190 | − av_free(pb); | |
| 189 | + av_free((*pb)->buffer); | |
| 190 | + avio_context_free(pb); | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | static void seg_free_context(SegmentContext *seg) |
| @@ -259,7 +259,7 @@ static int seg_write_header(AVFormatContext *s) · 65 unmodified lines | ||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | if (!seg->write_header_trailer) { |
| 262 | − close_null_ctx(oc->pb); | |
| 262 | + close_null_ctx(&oc->pb); | |
| 263 | 263 | if ((ret = s->io_open(s, &oc->pb, oc->filename, AVIO_FLAG_WRITE, NULL)) < 0) |
| 264 | 264 | goto fail; |
| 265 | 265 | } |
| @@ -353,7 +353,7 @@ static int seg_write_trailer(struct AVFormatContext *s) · 87 unmodified lines | ||
| 353 | 353 | if ((ret = open_null_ctx(&oc->pb)) < 0) |
| 354 | 354 | goto fail; |
| 355 | 355 | ret = av_write_trailer(oc); |
| 356 | − close_null_ctx(oc->pb); | |
| 356 | + close_null_ctx(&oc->pb); | |
| 357 | 357 | } else { |
| 358 | 358 | ret = segment_end(oc, 1); |
| 359 | 359 | } |
| @@ -187,8 +187,8 @@ static void ism_free(AVFormatContext *s) · 186 unmodified lines | ||
| 187 | 187 | os->out = os->out2 = os->tail_out = NULL; |
| 188 | 188 | if (os->ctx && os->ctx_inited) |
| 189 | 189 | av_write_trailer(os->ctx); |
| 190 | − if (os->ctx && os->ctx->pb) | |
| 191 | − av_free(os->ctx->pb); | |
| 190 | + if (os->ctx) | |
| 191 | + avio_context_free(&os->ctx->pb); | |
| 192 | 192 | if (os->ctx) |
| 193 | 193 | avformat_free_context(os->ctx); |
| 194 | 194 | av_free(os->private_str); |
| @@ -310,7 +310,9 @@ static av_cold int swf_read_close(AVFormatContext *avctx) · 309 unmodified lines | ||
| 310 | 310 | inflateEnd(&s->zstream); |
| 311 | 311 | av_freep(&s->zbuf_in); |
| 312 | 312 | av_freep(&s->zbuf_out); |
| 313 | − av_freep(&s->zpb); | |
| 313 | + | |
| 314 | + avio_context_free(&s->zpb); | |
| 315 | + | |
| 314 | 316 | return 0; |
| 315 | 317 | } |
| 316 | 318 | #endif |
| @@ -338,7 +338,7 @@ static void signal_init_ts(void) · 337 unmodified lines | ||
| 338 | 338 | static void finish(void) |
| 339 | 339 | { |
| 340 | 340 | av_write_trailer(ctx); |
| 341 | − av_free(ctx->pb); | |
| 341 | + avio_context_free(&ctx->pb); | |
| 342 | 342 | avformat_free_context(ctx); |
| 343 | 343 | ctx = NULL; |
| 344 | 344 | } |
| @@ -313,7 +313,7 @@ static void wtvfile_close(AVIOContext *pb) · 312 unmodified lines | ||
| 313 | 313 | av_free(wf->sectors); |
| 314 | 314 | av_free(wf); |
| 315 | 315 | av_free(pb->buffer); |
| 316 | − av_free(pb); | |
| 316 | + avio_context_free(&pb); | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /* |