diff options
author | Pavel Roskin <plroskin@gmail.com> | 2016-10-16 23:41:05 -0700 |
---|---|---|
committer | Pavel Roskin <plroskin@gmail.com> | 2016-10-21 20:15:50 +0000 |
commit | dc60a80b862a2e88b1179e8478b6d1ffb7c8249f (patch) | |
tree | 20fd52f3bbb19a6c03dd100c0c0bfc39da79a9fb /sesman | |
parent | e17a56efb6750e7db8d060bd1a648a946395ef80 (diff) | |
download | xrdp-proprietary-dc60a80b862a2e88b1179e8478b6d1ffb7c8249f.tar.gz xrdp-proprietary-dc60a80b862a2e88b1179e8478b6d1ffb7c8249f.zip |
Memory leak fix: keep X server path in the parameter list
g_cfg->xorg_params, g_cfg->vnc_params and g_cfg->rdp_params don't have
auto_free enabled, so removing an item from one of those lists won't free
its contents.
It's better not to change those lists, as they represent the actual
config file and could be reused. Instead, omit the 0th parameter (the
executable path) from copying to xserver_params.
Found by Valgrind.
Diffstat (limited to 'sesman')
-rw-r--r-- | sesman/session.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sesman/session.c b/sesman/session.c index 031b27f6..581af1ae 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -672,14 +672,13 @@ session_start_fork(int width, int height, int bpp, char *username, /* get path of Xorg from config */ xserver = g_strdup((const char *)list_get_item(g_cfg->xorg_params, 0)); - list_remove_item(g_cfg->xorg_params, 0); /* these are the must have parameters */ list_add_item(xserver_params, (tintptr) g_strdup(xserver)); list_add_item(xserver_params, (tintptr) g_strdup(screen)); /* additional parameters from sesman.ini file */ - list_append_list_strdup(g_cfg->xorg_params, xserver_params, 0); + list_append_list_strdup(g_cfg->xorg_params, xserver_params, 1); /* make sure it ends with a zero */ list_add_item(xserver_params, 0); @@ -706,7 +705,6 @@ session_start_fork(int width, int height, int bpp, char *username, /* get path of Xvnc from config */ xserver = g_strdup((const char *)list_get_item(g_cfg->vnc_params, 0)); - list_remove_item(g_cfg->vnc_params, 0); /* these are the must have parameters */ list_add_item(xserver_params, (tintptr)g_strdup(xserver)); @@ -723,7 +721,7 @@ session_start_fork(int width, int height, int bpp, char *username, /* additional parameters from sesman.ini file */ //config_read_xserver_params(SESMAN_SESSION_TYPE_XVNC, // xserver_params); - list_append_list_strdup(g_cfg->vnc_params, xserver_params, 0); + list_append_list_strdup(g_cfg->vnc_params, xserver_params, 1); /* make sure it ends with a zero */ list_add_item(xserver_params, 0); @@ -738,7 +736,6 @@ session_start_fork(int width, int height, int bpp, char *username, /* get path of X11rdp from config */ xserver = g_strdup((const char *)list_get_item(g_cfg->rdp_params, 0)); - list_remove_item(g_cfg->rdp_params, 0); /* these are the must have parameters */ list_add_item(xserver_params, (tintptr)g_strdup(xserver)); @@ -751,7 +748,7 @@ session_start_fork(int width, int height, int bpp, char *username, /* additional parameters from sesman.ini file */ //config_read_xserver_params(SESMAN_SESSION_TYPE_XRDP, // xserver_params); - list_append_list_strdup(g_cfg->rdp_params, xserver_params, 0); + list_append_list_strdup(g_cfg->rdp_params, xserver_params, 1); /* make sure it ends with a zero */ list_add_item(xserver_params, 0); |