fixed leak in host_create_from_string("%any")
authorMartin Willi <martin@strongswan.org>
Mon, 10 Nov 2008 16:42:05 +0000 (16:42 -0000)
committerMartin Willi <martin@strongswan.org>
Mon, 10 Nov 2008 16:42:05 +0000 (16:42 -0000)
src/libstrongswan/utils/host.c

index b8fc5d9..cfcb873 100644 (file)
@@ -392,13 +392,15 @@ static private_host_t *host_create_empty(void)
  */
 host_t *host_create_from_string(char *string, u_int16_t port)
 {
-       private_host_t *this = host_create_empty();
+       private_host_t *this;
        
        if (streq(string, "%any"))
        {
                return host_create_any(AF_INET);
        }
-       else if (strchr(string, '.'))
+       
+       this = host_create_empty();
+       if (strchr(string, '.'))
        {
                this->address.sa_family = AF_INET;
        }
@@ -406,7 +408,6 @@ host_t *host_create_from_string(char *string, u_int16_t port)
        {
                this->address.sa_family = AF_INET6;
        }
-
        switch (this->address.sa_family)
        {
                case AF_INET: