]> granicus.if.org Git - neomutt/commitdiff
Make sure Url is initialized even when u->scheme == U_UNKNOWN (#911)
authorPietro Cerutti <gahr@gahr.ch>
Sun, 5 Nov 2017 12:42:43 +0000 (12:42 +0000)
committerGitHub <noreply@github.com>
Sun, 5 Nov 2017 12:42:43 +0000 (12:42 +0000)
Fixed #910

url.c

diff --git a/url.c b/url.c
index c22c774f7da62156caaf746a0f65a69d4f3a82fd..87c0451e69f870ed70beea5b2d25fa59cbaf5108 100644 (file)
--- a/url.c
+++ b/url.c
@@ -152,12 +152,6 @@ int url_parse(struct Url *u, char *src)
 {
   char *t = NULL, *p = NULL;
 
-  u->scheme = url_check_scheme(src);
-  if (u->scheme == U_UNKNOWN)
-    return -1;
-
-  src = strchr(src, ':') + 1;
-
   u->user = NULL;
   u->pass = NULL;
   u->host = NULL;
@@ -165,6 +159,12 @@ int url_parse(struct Url *u, char *src)
   u->path = NULL;
   STAILQ_INIT(&u->query_strings);
 
+  u->scheme = url_check_scheme(src);
+  if (u->scheme == U_UNKNOWN)
+    return -1;
+
+  src = strchr(src, ':') + 1;
+
   if (strncmp(src, "//", 2) != 0)
   {
     u->path = src;