History

Use the new AVIOContext destructor.

Anton Khirnov committed 9 years ago

Commit 6f554521 parent 99684f311 files · +21 −19Browse files

Unified · Split

11 files
  1. avprobe.c +1 −1
  2. libavformat/avidec.c +2 −2
  3. libavformat/flac_picture.c +2 −2
  4. libavformat/hdsenc.c +2 −2
  5. libavformat/mpjpegdec.c +1 −1
  6. libavformat/rdt.c +1 −1
  7. libavformat/segment.c +5 −5
  8. libavformat/smoothstreamingenc.c +2 −2
  9. libavformat/swfdec.c +3 −1
  10. libavformat/tests/movenc.c +1 −1
  11. libavformat/wtv.c +1 −1
avprobe.c+1−1
@@ -1178,7 +1178,7 @@ int main(int argc, char **argv) · 1177 unmodified lines
11781178 ret = probe_file(input_filename);
11791179 probe_footer();
11801180 avio_flush(probe_out);
1181− av_freep(&probe_out);
1181+ avio_context_free(&probe_out);
11821182 av_freep(&buffer);
11831183 uninit_opts();
11841184 avformat_network_deinit();
libavformat/avidec.c+2−2
@@ -901,7 +901,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) · 900 unmodified lines
901901 return 1;
902902
903903 error:
904− av_freep(&pb);
904+ avio_context_free(&pb);
905905 }
906906 return 0;
907907 }
@@ -1576,7 +1576,7 @@ static int avi_read_close(AVFormatContext *s) · 668 unmodified lines
15761576 AVIStream *ast = st->priv_data;
15771577 if (ast) {
15781578 if (ast->sub_ctx) {
1579− av_freep(&ast->sub_ctx->pb);
1579+ avio_context_free(&ast->sub_ctx->pb);
15801580 avformat_close_input(&ast->sub_ctx);
15811581 }
15821582 av_free(ast->sub_buffer);
libavformat/flac_picture.c+2−2
@@ -139,14 +139,14 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) · 138 unmodified lines
139139 if (desc)
140140 av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL);
141141
142− av_freep(&pb);
142+ avio_context_free(&pb);
143143
144144 return 0;
145145
146146 fail:
147147 av_buffer_unref(&data);
148148 av_freep(&desc);
149− av_freep(&pb);
149+ avio_context_free(&pb);
150150
151151 return ret;
152152 }
libavformat/hdsenc.c+2−2
@@ -143,8 +143,8 @@ static void hds_free(AVFormatContext *s) · 142 unmodified lines
143143 ff_format_io_close(s, &os->out);
144144 if (os->ctx && os->ctx_inited)
145145 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);
148148 if (os->ctx)
149149 avformat_free_context(os->ctx);
150150 av_free(os->metadata);
libavformat/mpjpegdec.c+1−1
@@ -102,7 +102,7 @@ static int mpjpeg_read_probe(AVProbeData *p) · 101 unmodified lines
102102 }
103103 }
104104
105− av_free(pb);
105+ avio_context_free(&pb);
106106
107107 return ret;
108108 }
libavformat/rdt.c+1−1
@@ -324,7 +324,7 @@ get_cache: · 323 unmodified lines
324324 st, rdt->rmst[st->index], pkt);
325325 if (rdt->audio_pkt_cnt == 0 &&
326326 st->codecpar->codec_id == AV_CODEC_ID_AAC)
327− av_freep(&rdt->rmctx->pb);
327+ avio_context_free(&rdt->rmctx->pb);
328328 }
329329 pkt->stream_index = st->index;
330330 pkt->pts = *timestamp;
libavformat/segment.c+5−5
@@ -184,10 +184,10 @@ static int open_null_ctx(AVIOContext **ctx) · 183 unmodified lines
184184 return 0;
185185 }
186186
187−static void close_null_ctx(AVIOContext *pb)
187+static void close_null_ctx(AVIOContext **pb)
188188 {
189− av_free(pb->buffer);
190− av_free(pb);
189+ av_free((*pb)->buffer);
190+ avio_context_free(pb);
191191 }
192192
193193 static void seg_free_context(SegmentContext *seg)
@@ -259,7 +259,7 @@ static int seg_write_header(AVFormatContext *s) · 65 unmodified lines
259259 }
260260
261261 if (!seg->write_header_trailer) {
262− close_null_ctx(oc->pb);
262+ close_null_ctx(&oc->pb);
263263 if ((ret = s->io_open(s, &oc->pb, oc->filename, AVIO_FLAG_WRITE, NULL)) < 0)
264264 goto fail;
265265 }
@@ -353,7 +353,7 @@ static int seg_write_trailer(struct AVFormatContext *s) · 87 unmodified lines
353353 if ((ret = open_null_ctx(&oc->pb)) < 0)
354354 goto fail;
355355 ret = av_write_trailer(oc);
356− close_null_ctx(oc->pb);
356+ close_null_ctx(&oc->pb);
357357 } else {
358358 ret = segment_end(oc, 1);
359359 }
libavformat/smoothstreamingenc.c+2−2
@@ -187,8 +187,8 @@ static void ism_free(AVFormatContext *s) · 186 unmodified lines
187187 os->out = os->out2 = os->tail_out = NULL;
188188 if (os->ctx && os->ctx_inited)
189189 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);
192192 if (os->ctx)
193193 avformat_free_context(os->ctx);
194194 av_free(os->private_str);
libavformat/swfdec.c+3−1
@@ -310,7 +310,9 @@ static av_cold int swf_read_close(AVFormatContext *avctx) · 309 unmodified lines
310310 inflateEnd(&s->zstream);
311311 av_freep(&s->zbuf_in);
312312 av_freep(&s->zbuf_out);
313− av_freep(&s->zpb);
313+
314+ avio_context_free(&s->zpb);
315+
314316 return 0;
315317 }
316318 #endif
libavformat/tests/movenc.c+1−1
@@ -338,7 +338,7 @@ static void signal_init_ts(void) · 337 unmodified lines
338338 static void finish(void)
339339 {
340340 av_write_trailer(ctx);
341− av_free(ctx->pb);
341+ avio_context_free(&ctx->pb);
342342 avformat_free_context(ctx);
343343 ctx = NULL;
344344 }
libavformat/wtv.c+1−1
@@ -313,7 +313,7 @@ static void wtvfile_close(AVIOContext *pb) · 312 unmodified lines
313313 av_free(wf->sectors);
314314 av_free(wf);
315315 av_free(pb->buffer);
316− av_free(pb);
316+ avio_context_free(&pb);
317317 }
318318
319319 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t