summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-02 19:59:09 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-05 12:08:18 +0100
commitfed46d77062755a8488144071239aaf00fc5a8b9 (patch)
tree6c3857115f28ed4965d4bf2616f9358fefc0f1d9
parentc856e4c5469761390d278e4c5953d86df1d64a21 (diff)
avformat/avio: Avoid av_strdup(NULL)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavformat/avio.c20
1 files 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;