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) */ * now let's activate the current layout (next in list) */
if (current_layout_found) { if (current_layout_found) {
new_layout = layout; new_layout = layout;
free(tm_dup);
break; break;
} }
@ -1925,6 +1924,7 @@ void con_toggle_layout(Con *con, const char *toggle_mode) {
current_layout_found = true; current_layout_found = true;
} }
} }
free(tm_dup);
if (new_layout != L_DEFAULT) { if (new_layout != L_DEFAULT) {
con_set_layout(con, new_layout); 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; struct Assignment *assign;
while (!TAILQ_EMPTY(&assignments)) { while (!TAILQ_EMPTY(&assignments)) {
assign = TAILQ_FIRST(&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); FREE(assign->dest.workspace);
else if (assign->type == A_COMMAND) else if (assign->type == A_COMMAND)
FREE(assign->dest.command); FREE(assign->dest.command);

View File

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

View File

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