]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
url: fix urlcopy()
authorJaroslav Kysela <perex@perex.cz>
Sat, 2 Dec 2017 17:59:36 +0000 (18:59 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 3 Dec 2017 08:59:42 +0000 (09:59 +0100)
src/url.c

index 43b1163efc1856caec3ef2ca501bce1acc31a977..0d54ced695e883e1f5b186a4bb67727e9c607691 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -43,15 +43,15 @@ urlreset ( url_t *url )
 void
 urlcopy ( url_t *dst, const url_t *src )
 {
-  dst->scheme = strdup(src->scheme);
-  dst->user   = strdup(src->user);
-  dst->pass   = strdup(src->pass);
-  dst->host   = strdup(src->host);
+  dst->scheme = src->scheme ? strdup(src->scheme) : NULL;
+  dst->user   = src->user ? strdup(src->user) : NULL;
+  dst->pass   = src->pass ? strdup(src->pass) : NULL;
+  dst->host   = src->host ? strdup(src->host) : NULL;
   dst->port   = src->port;
-  dst->path   = strdup(src->path);
-  dst->query  = strdup(src->query);
-  dst->frag   = strdup(src->frag);
-  dst->raw    = strdup(src->raw);
+  dst->path   = src->path ? strdup(src->path) : NULL;
+  dst->query  = src->query ? strdup(src->query) : NULL;
+  dst->frag   = src->frag ? strdup(src->frag) : NULL;
+  dst->raw    = src->raw ? strdup(src->raw) : NULL;
 }
 
 /* Use liburiparser if available */