summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Roskin <plroskin@gmail.com>2016-10-20 22:22:51 -0700
committerPavel Roskin <plroskin@gmail.com>2016-10-21 20:15:50 +0000
commitb28a986071ba3ee1bb8aac7dce7b211ad4f07504 (patch)
tree20cde65a4c5e011d1447c0d49ba1549658ad1f95
parentdc60a80b862a2e88b1179e8478b6d1ffb7c8249f (diff)
downloadxrdp-proprietary-b28a986071ba3ee1bb8aac7dce7b211ad4f07504.tar.gz
xrdp-proprietary-b28a986071ba3ee1bb8aac7dce7b211ad4f07504.zip
Fix memory leak in xrdp-sesman on config reload
-rw-r--r--sesman/config.c16
-rw-r--r--sesman/config.h3
-rw-r--r--sesman/sig.c3
3 files changed, 22 insertions, 0 deletions
diff --git a/sesman/config.c b/sesman/config.c
index 69ba1c18..0c169938 100644
--- a/sesman/config.c
+++ b/sesman/config.c
@@ -374,6 +374,7 @@ config_read_rdp_params(int file, struct config_sesman *cs, struct list *param_n,
list_clear(param_n);
cs->rdp_params = list_create();
+ cs->rdp_params->auto_free = 1;
file_read_section(file, SESMAN_CFG_RDP_PARAMS, param_n, param_v);
@@ -404,6 +405,7 @@ config_read_xorg_params(int file, struct config_sesman *cs,
list_clear(param_n);
cs->xorg_params = list_create();
+ cs->xorg_params->auto_free = 1;
file_read_section(file, SESMAN_CFG_XORG_PARAMS, param_n, param_v);
@@ -436,6 +438,7 @@ config_read_vnc_params(int file, struct config_sesman *cs, struct list *param_n,
list_clear(param_n);
cs->vnc_params = list_create();
+ cs->vnc_params->auto_free = 1;
file_read_section(file, SESMAN_CFG_VNC_PARAMS, param_n, param_v);
@@ -466,7 +469,9 @@ config_read_session_variables(int file, struct config_sesman *cs,
list_clear(param_n);
cs->session_variables1 = list_create();
+ cs->session_variables1->auto_free = 1;
cs->session_variables2 = list_create();
+ cs->session_variables2->auto_free = 1;
file_read_section(file, SESMAN_CFG_SESSION_VARIABLES, param_n, param_v);
@@ -490,3 +495,14 @@ config_read_session_variables(int file, struct config_sesman *cs,
return 0;
}
+
+void
+config_free(struct config_sesman *cs)
+{
+ list_delete(cs->rdp_params);
+ list_delete(cs->vnc_params);
+ list_delete(cs->xorg_params);
+ list_delete(cs->session_variables1);
+ list_delete(cs->session_variables2);
+ g_free(cs);
+}
diff --git a/sesman/config.h b/sesman/config.h
index 14fc4f98..2baef632 100644
--- a/sesman/config.h
+++ b/sesman/config.h
@@ -356,4 +356,7 @@ int DEFAULT_CC
config_read_session_variables(int file, struct config_sesman *cs,
struct list *param_n, struct list *param_v);
+void
+config_free(struct config_sesman *cs);
+
#endif
diff --git a/sesman/sig.c b/sesman/sig.c
index 13f9c46c..579b5876 100644
--- a/sesman/sig.c
+++ b/sesman/sig.c
@@ -91,6 +91,9 @@ sig_sesman_reload_cfg(int sig)
/* stop logging subsystem */
log_end();
+ /* free old config data */
+ config_free(g_cfg);
+
/* replace old config with newly read one */
g_cfg = cfg;