]> git.sesse.net Git - ffmpeg/commitdiff
avformat/aviobuf: Honor avio_open[2] documentation
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 6 Jan 2020 14:51:49 +0000 (15:51 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 7 Jan 2020 01:44:05 +0000 (02:44 +0100)
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>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/aviobuf.c

index 70e1d2ca1026a165148401a11047126ce8326290..384c3a4cb63ff14ee58cee70b19edb6013370fd0 100644 (file)
@@ -1197,6 +1197,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;