From de5c0c8e2517876f6d94b2f0fcb5021b2cf52116 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Fri, 22 Jul 2011 12:52:57 +0800 Subject: [PATCH] libfreerdp-core/settings: fix memory issues. --- libfreerdp-core/settings.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libfreerdp-core/settings.c b/libfreerdp-core/settings.c index 76a63aa8c..b9e662576 100644 --- a/libfreerdp-core/settings.c +++ b/libfreerdp-core/settings.c @@ -17,9 +17,14 @@ * limitations under the License. */ +#include "config.h" #include "capabilities.h" #include +#ifdef HAVE_UNISTD_H +#include +#endif + #include static char client_dll[] = "C:\\Windows\\System32\\mstscax.dll"; @@ -90,8 +95,7 @@ rdpSettings* settings_new() settings->draw_nine_grid_cache_size = 2560; settings->draw_nine_grid_cache_entries = 256; - settings->client_dir = xmalloc(strlen(client_dll)); - strcpy(settings->client_dir, client_dll); + settings->client_dir = (uint8*)xstrdup(client_dll); settings->uniconv = freerdp_uniconv_new(); gethostname(settings->client_hostname, sizeof(settings->client_hostname) - 1); @@ -105,6 +109,13 @@ void settings_free(rdpSettings* settings) if (settings != NULL) { freerdp_uniconv_free(settings->uniconv); + xfree(settings->hostname); + xfree(settings->username); + xfree(settings->password); + xfree(settings->domain); + xfree(settings->shell); + xfree(settings->directory); + xfree(settings->client_dir); xfree(settings); } }