summaryrefslogtreecommitdiff
path: root/libavformat/avio.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-03-17 01:53:02 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-03-17 02:09:39 +0100
commit6b7ce0ea0d6271cd788888cec9baa48fc088bde5 (patch)
treea3db89b723698093c8767a2159264706b1de63ed /libavformat/avio.c
parent06267afe1cec91656447458e029900dbe8536603 (diff)
downloadffmpeg-6b7ce0ea0d6271cd788888cec9baa48fc088bde5.tar.gz
avformat/avio: Fix unknown protocol handling
Fixes regression since bb8cc89b2986df6f60831b67cd250da312cce1d0 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r--libavformat/avio.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 0be820b9ec..b2c2178e4c 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -249,7 +249,6 @@ int ffurl_handshake(URLContext *c)
static const struct URLProtocol *url_find_protocol(const char *filename)
{
- const URLProtocol *up;
const URLProtocol **protocols;
char proto_str[128], proto_nested[128], *ptr;
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
@@ -271,16 +270,19 @@ static const struct URLProtocol *url_find_protocol(const char *filename)
protocols = ffurl_get_protocols(NULL, NULL);
for (i = 0; protocols[i]; i++) {
- up = protocols[i];
- if (!strcmp(proto_str, up->name))
- break;
+ const URLProtocol *up = protocols[i];
+ if (!strcmp(proto_str, up->name)) {
+ av_freep(&protocols);
+ return up;
+ }
if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME &&
- !strcmp(proto_nested, up->name))
- break;
+ !strcmp(proto_nested, up->name)) {
+ av_freep(&protocols);
+ return up;
+ }
}
- av_freep(&protocols);
- return up;
+ return NULL;
}
int ffurl_alloc(URLContext **puc, const char *filename, int flags,