[FFmpeg-devel] [PATCH V1 1/2] examples/avio_reading: Use avio_context_free() to free AVIOContext

Jun Zhao mypopydev at gmail.com
Sun Apr 21 10:57:55 EEST 2019


From: Jun Zhao <barryjzhao at tencent.com>

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
---
 doc/examples/avio_reading.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/examples/avio_reading.c b/doc/examples/avio_reading.c
index cbfeb17..36ee02a 100644
--- a/doc/examples/avio_reading.c
+++ b/doc/examples/avio_reading.c
@@ -117,11 +117,12 @@ int main(int argc, char *argv[])
 
 end:
     avformat_close_input(&fmt_ctx);
+
     /* note: the internal buffer could have changed, and be != avio_ctx_buffer */
-    if (avio_ctx) {
+    if (avio_ctx)
         av_freep(&avio_ctx->buffer);
-        av_freep(&avio_ctx);
-    }
+    avio_context_free(&avio_ctx);
+
     av_file_unmap(buffer, buffer_size);
 
     if (ret < 0) {
-- 
1.7.1



More information about the ffmpeg-devel mailing list