aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/workspace.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-05 08:35:00 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-05 08:35:00 -0500
commitf2abe0570ff2febe8a25de122c8dc95c49ef8282 (patch)
tree6f61ddadade2d6938851ec042ed5a083b51a3b1a /sway/commands/workspace.c
parentFix quote stripping (diff)
downloadsway-f2abe0570ff2febe8a25de122c8dc95c49ef8282.tar.gz
sway-f2abe0570ff2febe8a25de122c8dc95c49ef8282.tar.zst
sway-f2abe0570ff2febe8a25de122c8dc95c49ef8282.zip
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
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r--sway/commands/workspace.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c
index c5d6435a..65a3f407 100644
--- a/sway/commands/workspace.c
+++ b/sway/commands/workspace.c
@@ -76,7 +76,6 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv,
76 char *end; 76 char *end;
77 int amount = strtol(argv[gaps_location + 2], &end, 10); 77 int amount = strtol(argv[gaps_location + 2], &end, 10);
78 if (strlen(end)) { 78 if (strlen(end)) {
79 free(end);
80 return cmd_results_new(CMD_FAILURE, expected); 79 return cmd_results_new(CMD_FAILURE, expected);
81 } 80 }
82 81