Fix memory leak in xrdp-sesman on config reload

master
Pavel Roskin 8 years ago
parent dc60a80b86
commit b28a986071

@ -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);
}

@ -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

@ -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;

Loading…
Cancel
Save