]> sjero.net Git - wget/blobdiff - src/url.c
[svn] Applied Dennis Smit's --preserve-permissions patch.
[wget] / src / url.c
index 132479428ec2e27497a1a1abfb95bc79a704e974..dd93592a408a9392665fc09290a9a44f53c680fb 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -971,9 +971,7 @@ url_parse (const char *url, int *error)
        }
     }
 
-  u = (struct url *)xmalloc (sizeof (struct url));
-  memset (u, 0, sizeof (*u));
-
+  u = xnew0 (struct url);
   u->scheme = scheme;
   u->host   = strdupdelim (host_b, host_e);
   u->port   = port;
@@ -1238,11 +1236,11 @@ url_free (struct url *url)
   xfree (url->path);
   xfree (url->url);
 
-  FREE_MAYBE (url->params);
-  FREE_MAYBE (url->query);
-  FREE_MAYBE (url->fragment);
-  FREE_MAYBE (url->user);
-  FREE_MAYBE (url->passwd);
+  xfree_null (url->params);
+  xfree_null (url->query);
+  xfree_null (url->fragment);
+  xfree_null (url->user);
+  xfree_null (url->passwd);
 
   xfree (url->dir);
   xfree (url->file);