Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 4/4] avformat/avio: Avoid av_strdup(NULL)
Date: Sat,  2 Mar 2024 20:51:59 +0100
Message-ID: <AS8P250MB0744BA865F2600C2C154ECCF8F5D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB07444E7A2DBA4FA55D5C0D5E8F5D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/avio.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index f3d10fac39..5186c2b464 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -436,15 +436,19 @@ int ffio_fdopen(AVIOContext **sp, URLContext *h)
         return AVERROR(ENOMEM);
     }
     s = *sp;
-    s->protocol_whitelist = av_strdup(h->protocol_whitelist);
-    if (!s->protocol_whitelist && h->protocol_whitelist) {
-        avio_closep(sp);
-        return AVERROR(ENOMEM);
+    if (h->protocol_whitelist) {
+        s->protocol_whitelist = av_strdup(h->protocol_whitelist);
+        if (!s->protocol_whitelist) {
+            avio_closep(sp);
+            return AVERROR(ENOMEM);
+        }
     }
-    s->protocol_blacklist = av_strdup(h->protocol_blacklist);
-    if (!s->protocol_blacklist && h->protocol_blacklist) {
-        avio_closep(sp);
-        return AVERROR(ENOMEM);
+    if (h->protocol_blacklist) {
+        s->protocol_blacklist = av_strdup(h->protocol_blacklist);
+        if (!s->protocol_blacklist) {
+            avio_closep(sp);
+            return AVERROR(ENOMEM);
+        }
     }
     s->direct = h->flags & AVIO_FLAG_DIRECT;
 
-- 
2.40.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2024-03-02 19:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02 19:50 [FFmpeg-devel] [PATCH 1/4] avformat/aviobuf: Move code specific to URLContexts to avio.c Andreas Rheinhardt
2024-03-02 19:51 ` [FFmpeg-devel] [PATCH 2/4] avformat/avio: Avoid function pointer casts Andreas Rheinhardt
2024-03-02 19:51 ` [FFmpeg-devel] [PATCH 3/4] avformat/avio: Avoid indirection in ffio_fdopen() Andreas Rheinhardt
2024-03-02 19:51 ` Andreas Rheinhardt [this message]
2024-03-04 16:12 ` [FFmpeg-devel] [PATCH 1/4] avformat/aviobuf: Move code specific to URLContexts to avio.c Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744BA865F2600C2C154ECCF8F5D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git