free(context);
free(new);
free(buf);
+
+ while (!SLIST_EMPTY(&variables)) {
+ current = SLIST_FIRST(&variables);
+ FREE(current->key);
+ FREE(current->value);
+ SLIST_REMOVE_HEAD(&variables, variables);
+ FREE(current);
+ }
}
%}
new->keycode = $<number>2;
new->mods = $<number>1;
- new->command = sstrdup($<string>4);
+ new->command = $<string>4;
$<binding>$ = new;
}
printf("\tFound symbolic mod%d with key %s and command %s\n", $<number>1, $<string>2, $<string>4);
Binding *new = scalloc(sizeof(Binding));
- new->symbol = sstrdup($<string>2);
+ new->symbol = $<string>2;
new->mods = $<number>1;
- new->command = sstrdup($<string>4);
+ new->command = $<string>4;
$<binding>$ = new;
}
}
struct Mode *mode = scalloc(sizeof(struct Mode));
- mode->name = strdup($<string>3);
+ mode->name = $<string>3;
mode->bindings = current_bindings;
current_bindings = NULL;
SLIST_INSERT_HEAD(&modes, mode, modes);
TOKNEWWINDOW WHITESPACE WORD
{
DLOG("new windows should start in mode %s\n", $<string>3);
- config.default_border = strdup($<string>3);
+ config.default_border = sstrdup($<string>3);
}
;
DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
} else {
Workspace *ws = workspace_get(ws_num - 1);
- ws->preferred_output = sstrdup($<string>7);
- if ($<string>8 != NULL)
+ ws->preferred_output = $<string>7;
+ if ($<string>8 != NULL) {
workspace_set_name(ws, $<string>8);
+ free($<string>8);
+ }
}
}
| TOKWORKSPACE WHITESPACE NUMBER WHITESPACE workspace_name
DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
} else {
DLOG("workspace name to: %s\n", $<string>5);
- if ($<string>5 != NULL)
+ if ($<string>5 != NULL) {
workspace_set_name(workspace_get(ws_num - 1), $<string>5);
+ free($<string>5);
+ }
}
}
;
struct Assignment *new = $<assignment>6;
printf(" to %d\n", new->workspace);
printf(" floating = %d\n", new->floating);
- new->windowclass_title = strdup($<string>3);
+ new->windowclass_title = $<string>3;
TAILQ_INSERT_TAIL(&assignments, new, assignments);
}
;
ipcsocket:
TOKIPCSOCKET WHITESPACE STR
{
- config.ipc_socket_path = sstrdup($<string>3);
+ config.ipc_socket_path = $<string>3;
}
;
TOKEXEC WHITESPACE STR
{
struct Autostart *new = smalloc(sizeof(struct Autostart));
- new->command = sstrdup($<string>3);
+ new->command = $<string>3;
TAILQ_INSERT_TAIL(&autostarts, new, autostarts);
}
;
font:
TOKFONT WHITESPACE STR
{
- config.font = sstrdup($<string>3);
+ config.font = $<string>3;
printf("font %s\n", config.font);
}
;
if (!existing)
new = scalloc(sizeof(Output));
new->id = id;
+ FREE(new->name);
asprintf(&new->name, "%.*s",
xcb_randr_get_output_info_name_length(output),
xcb_randr_get_output_info_name(output));
TAILQ_INSERT_TAIL(&outputs, new, outputs);
else if (new->active)
new->to_be_disabled = true;
- free(output);
return;
}
DLOG("Skipping output %s: could not get CRTC (%p)\n",
new->name, crtc);
free(new);
- free(output);
return;
}
if (!updated || !existing) {
if (!existing)
TAILQ_INSERT_TAIL(&outputs, new, outputs);
- free(output);
return;
}
continue;
handle_output(conn, randr_outputs[i], output, cts, res);
+ free(output);
}
free(res);