Переглянути джерело

Use the new AVIOContext destructor.

(cherry picked from commit 6f554521afdf7ab4edbfaa9536660a1dca946b19)
Signed-off-by: James Almer <jamrial@gmail.com>
Anton Khirnov 8 роки тому
батько
коміт
78a7af823b

+ 1 - 1
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;
 }

+ 2 - 2
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;
 }

+ 1 - 1
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);

+ 1 - 1
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;
 }

+ 1 - 1
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;

+ 1 - 1
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)

+ 1 - 1
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);

+ 1 - 1
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

+ 1 - 1
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;
 }

+ 1 - 1
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);
 }
 
 /*