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

Andreas Rheinhardt git at videolan.org
Wed May 20 08:39:06 EEST 2020


ffmpeg | branch: release/4.2 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Jan  6 15:51:49 2020 +0100| [e13e36f3224b2f90d604b457d25337655715bef7] | committer: Andreas Rheinhardt

avformat/aviobuf: Honor avio_open[2] documentation

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>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 220846f74fc33fc037147e54535bcaef8caad28b)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e13e36f3224b2f90d604b457d25337655715bef7
---

 libavformat/aviobuf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 2d011027c9..de9f210d2d 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1163,6 +1163,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;



More information about the ffmpeg-cvslog mailing list