[FFmpeg-devel] [PATCH 2/2] avformat/aviobuf: Honor avio_open[2] documentation

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Jan 6 16:51:49 EET 2020


The documentation of both avio_open() as well as avio_open2() states
that on failure, the pointer to an AVIOContext given to this function
(via a pointer to a pointer to an AVIOContext) will be set to NULL. Yet
it didn't happen upon failure of ffurl_open_whitelist() or when allocating
the internal buffer failed. This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/aviobuf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 0e2f038988..cc22beff28 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1145,6 +1145,8 @@ int ffio_open_whitelist(AVIOContext **s, const char *filename, int flags,
     URLContext *h;
     int err;
 
+    *s = NULL;
+
     err = ffurl_open_whitelist(&h, filename, flags, int_cb, options, whitelist, blacklist, NULL);
     if (err < 0)
         return err;
-- 
2.20.1



More information about the ffmpeg-devel mailing list