cfg_workspace: memleak on duplicate workspace assignment
assignment->output is set but lost since TAILQ_INSERT_TAIL is never called when duplicate is set. This essentially happens on every reload.
This commit is contained in:
parent
ee1f551195
commit
a5014dc7f8
|
@ -328,21 +328,18 @@ CFGFUN(workspace, const char *workspace, const char *output) {
|
||||||
* don’t have assignments of a single workspace to different
|
* don’t 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) {
|
||||||
|
|
Loading…
Reference in New Issue