fix a double free in redirection.c/settings.c and a memory leak in connection.c

This commit is contained in:
Alexis Moinet 2011-11-24 16:45:34 +01:00
parent d778564a52
commit 4777d8f021
2 changed files with 17 additions and 4 deletions

View File

@ -132,16 +132,23 @@ boolean rdp_client_redirect(rdpRdp* rdp)
if (redirection->flags & LB_LOAD_BALANCE_INFO)
nego_set_routing_token(rdp->nego, &redirection->loadBalanceInfo);
if (redirection->flags & LB_TARGET_NET_ADDRESS)
if (redirection->flags & LB_TARGET_NET_ADDRESS) {
xfree(settings->hostname);
settings->hostname = redirection->targetNetAddress.ascii;
else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
} else if (redirection->flags & LB_TARGET_NETBIOS_NAME) {
xfree(settings->hostname);
settings->hostname = redirection->targetNetBiosName.ascii;
}
if (redirection->flags & LB_USERNAME)
if (redirection->flags & LB_USERNAME) {
xfree(settings->username);
settings->username = redirection->username.ascii;
}
if (redirection->flags & LB_DOMAIN)
if (redirection->flags & LB_DOMAIN) {
xfree(settings->domain);
settings->domain = redirection->domain.ascii;
}
return rdp_client_connect(rdp);
}

View File

@ -186,6 +186,12 @@ void redirection_free(rdpRedirection* redirection)
{
if (redirection != NULL)
{
//these four have already been freed in settings_free() and freerdp_string_free() checks for NULL
redirection->username.ascii = NULL;
redirection->domain.ascii = NULL;
redirection->targetNetAddress.ascii = NULL;
redirection->targetNetBiosName.ascii = NULL;
freerdp_string_free(&redirection->tsvUrl);
freerdp_string_free(&redirection->username);
freerdp_string_free(&redirection->domain);