free_pattern_spec(fwd->url);
freez(fwd->gateway_host);
freez(fwd->forward_host);
+ freez(fwd->auth_username);
+ freez(fwd->auth_password);
free(fwd);
return;
char **username, char **password)
{
char *p;
- *hostname = strdup_or_die(address);
+ char *tmp;
+
+ tmp = *hostname = strdup_or_die(address);
/* Parse username and password */
if (username && password && (NULL != (p = strchr(*hostname, '@'))))
{
*p++ = '\0';
- *username = *hostname;
- *hostname = p;
+ *username = strdup_or_die(*hostname);
+ *hostname = strdup_or_die(p);
if (NULL != (p = strchr(*username, ':')))
{
*p++ = '\0';
*password = strdup_or_die(p);
}
+ freez(tmp);
}
/* Parse hostname and port */