libfreerdp-core: fix settings->HomePath leak (issue #810)

This commit is contained in:
Marc-André Moreau 2012-12-13 07:48:09 -05:00
parent 47b98ec00e
commit 26492f1cc7
2 changed files with 10 additions and 1 deletions

View File

@ -450,6 +450,7 @@ void freerdp_settings_free(rdpSettings* settings)
key_free(settings->RdpServerRsaKey);
free(settings->ConfigPath);
free(settings->CurrentPath);
free(settings->HomePath);
freerdp_device_collection_free(settings);
freerdp_static_channel_collection_free(settings);
freerdp_dynamic_channel_collection_free(settings);

View File

@ -85,8 +85,16 @@ BOOL freerdp_check_file_exists(char* file)
char* freerdp_get_home_path(rdpSettings* settings)
{
char* home_env = NULL;
if (settings->HomePath == NULL)
settings->HomePath = getenv(HOME_ENV_VARIABLE);
{
home_env = getenv(HOME_ENV_VARIABLE);
if (home_env)
settings->HomePath = _strdup(home_env);
}
if (settings->HomePath == NULL)
settings->HomePath = _strdup("/");