diff mbox series

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

Message ID 20200106145149.18688-2-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avformat/aviobuf: Remove AVIOInternal and one level of indirection | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 6, 2020, 2:51 p.m. UTC
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@gmail.com>
---
 libavformat/aviobuf.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Jan. 7, 2020, 1:54 a.m. UTC | #1
On Mon, Jan 06, 2020 at 03:51:49PM +0100, Andreas Rheinhardt wrote:
> 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@gmail.com>
> ---
>  libavformat/aviobuf.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

thx

[...]
diff mbox series

Patch

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;