reload: fix memory leak

next
Michael Stapelberg 2016-01-09 13:46:49 +01:00
parent 79594398e2
commit e7f1476180
3 changed files with 8 additions and 1 deletions

View File

@ -94,7 +94,7 @@ struct Config {
i3Font font;
char *ipc_socket_path;
const char *restart_state_path;
char *restart_state_path;
layout_t default_layout;
int container_stack_limit;

View File

@ -169,6 +169,10 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
/* Get rid of the current font */
free_font();
free(config.ipc_socket_path);
free(config.restart_state_path);
free(config.fake_outputs);
}
SLIST_INIT(&modes);

View File

@ -261,6 +261,7 @@ CFGFUN(workspace_back_and_forth, const char *value) {
}
CFGFUN(fake_outputs, const char *outputs) {
free(config.fake_outputs);
config.fake_outputs = sstrdup(outputs);
}
@ -313,10 +314,12 @@ CFGFUN(workspace, const char *workspace, const char *output) {
}
CFGFUN(ipc_socket, const char *path) {
free(config.ipc_socket_path);
config.ipc_socket_path = sstrdup(path);
}
CFGFUN(restart_state, const char *path) {
free(config.restart_state_path);
config.restart_state_path = sstrdup(path);
}