]> git.sesse.net Git - ffmpeg/commitdiff
examples/avio_reading: Use avio_context_free() to free AVIOContext
authorJun Zhao <barryjzhao@tencent.com>
Sun, 21 Apr 2019 02:59:53 +0000 (10:59 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Tue, 23 Apr 2019 00:36:39 +0000 (08:36 +0800)
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
doc/examples/avio_reading.c

index cbfeb174b8ce43c5fed7510bcb940e8126a7b3ed..36ee02afa541a6d87ec87f0f52ae73221567ece9 100644 (file)
@@ -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) {