mirror of
https://github.com/swaywm/sway.git
synced 2024-11-11 04:54:14 +01:00
cmd_workspace_gaps: fix double free on bad amount
This fixes a double free in cmd_workspace_gaps when the amount given is invalid. The end pointer from strtol is part of the argument and should not be freed. Freeing the end pointer could result in a double free or bad free depending on whether or not the end pointer was at the start of the argument
This commit is contained in:
parent
9346ed1805
commit
0c091bed76
@ -76,7 +76,6 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv,
|
||||
char *end;
|
||||
int amount = strtol(argv[gaps_location + 2], &end, 10);
|
||||
if (strlen(end)) {
|
||||
free(end);
|
||||
return cmd_results_new(CMD_FAILURE, expected);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user