mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 17:01:29 +00:00
Minor fix to memory management
This commit is contained in:
parent
698685ee72
commit
78f7af18c6
|
@ -26,8 +26,8 @@ char *workspace_next_name(void) {
|
||||||
|
|
||||||
if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) {
|
if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) {
|
||||||
sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", args->items[1]);
|
sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", args->items[1]);
|
||||||
const char* target = args->items[1];
|
char* target = malloc(strlen(args->items[1]) + 1);
|
||||||
|
strcpy(target, args->items[1]);
|
||||||
while (*target == ' ' || *target == '\t')
|
while (*target == ' ' || *target == '\t')
|
||||||
target++;
|
target++;
|
||||||
|
|
||||||
|
@ -43,13 +43,14 @@ char *workspace_next_name(void) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Make sure that the workspace doesn't already exist
|
//Make sure that the workspace doesn't already exist
|
||||||
if (workspace_find_by_name(args->items[1]))
|
if (workspace_find_by_name(target)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
list_free(args);
|
list_free(args);
|
||||||
|
|
||||||
sway_log(L_DEBUG, "Workspace: Found free name %s", args->items[1]);
|
sway_log(L_DEBUG, "Workspace: Found free name %s", target);
|
||||||
return args->items[1];
|
return target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// As a fall back, get the current number of active workspaces
|
// As a fall back, get the current number of active workspaces
|
||||||
|
|
Loading…
Reference in a new issue