Merge pull request #3203 from orestisf1993/free

memory leaks
This commit is contained in:
Ingo Bürk 2018-03-25 20:12:16 +02:00 committed by GitHub
commit f560519f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 11 deletions

View File

@ -1917,7 +1917,6 @@ void con_toggle_layout(Con *con, const char *toggle_mode) {
* now let's activate the current layout (next in list) */
if (current_layout_found) {
new_layout = layout;
free(tm_dup);
break;
}
@ -1925,6 +1924,7 @@ void con_toggle_layout(Con *con, const char *toggle_mode) {
current_layout_found = true;
}
}
free(tm_dup);
if (new_layout != L_DEFAULT) {
con_set_layout(con, new_layout);

View File

@ -99,7 +99,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
struct Assignment *assign;
while (!TAILQ_EMPTY(&assignments)) {
assign = TAILQ_FIRST(&assignments);
if (assign->type == A_TO_WORKSPACE)
if (assign->type == A_TO_WORKSPACE || assign->type == A_TO_WORKSPACE_NUMBER)
FREE(assign->dest.workspace);
else if (assign->type == A_COMMAND)
FREE(assign->dest.command);

View File

@ -328,21 +328,18 @@ CFGFUN(workspace, const char *workspace, const char *output) {
* dont have assignments of a single workspace to different
* outputs */
struct Workspace_Assignment *assignment;
bool duplicate = false;
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcasecmp(assignment->name, workspace) == 0) {
ELOG("You have a duplicate workspace assignment for workspace \"%s\"\n",
workspace);
assignment->output = sstrdup(output);
duplicate = true;
return;
}
}
if (!duplicate) {
assignment = scalloc(1, sizeof(struct Workspace_Assignment));
assignment->name = sstrdup(workspace);
assignment->output = sstrdup(output);
TAILQ_INSERT_TAIL(&ws_assignments, assignment, ws_assignments);
}
}
CFGFUN(ipc_socket, const char *path) {

View File

@ -49,6 +49,7 @@ static void startup_timeout(EV_P_ ev_timer *w, int revents) {
if (!sequence) {
DLOG("Sequence already deleted, nevermind.\n");
free(w);
return;
}