From 0c091bed769b43089191d5f62cdd81ef399cfd98 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Tue, 5 Feb 2019 08:35:00 -0500 Subject: 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 --- sway/commands/workspace.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index c5d6435..65a3f40 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, char *end; int amount = strtol(argv[gaps_location + 2], &end, 10); if (strlen(end)) { - free(end); return cmd_results_new(CMD_FAILURE, expected); } -- cgit v1.1