From f821bfb2b38cec99af408f1990f815a1f31700e9 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 10 Nov 2008 16:42:05 +0000 Subject: [PATCH] fixed leak in host_create_from_string("%any") --- src/libstrongswan/utils/host.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libstrongswan/utils/host.c b/src/libstrongswan/utils/host.c index b8fc5d938..cfcb87373 100644 --- a/src/libstrongswan/utils/host.c +++ b/src/libstrongswan/utils/host.c @@ -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: