summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
authortcunha <tcunha>2009-11-18 01:24:33 (GMT)
committer tcunha <tcunha>2009-11-18 01:24:33 (GMT)
commita4985038049b900834334ef1ae0cf7943df1611a (patch) (side-by-side diff)
tree5057506601083024f5a06355782aff32106fdae3 /cmd-string.c
parent9930b98cc8803c54dd4345ecf309a6ece7d3b983 (diff)
downloadtmux-old-a4985038049b900834334ef1ae0cf7943df1611a.zip
tmux-old-a4985038049b900834334ef1ae0cf7943df1611a.tar.gz
tmux-old-a4985038049b900834334ef1ae0cf7943df1611a.tar.bz2
Sync OpenBSD patchset 541:
I made a complete horlicks of the last change, fix it so it doesn't either lead to a double free or free the item after the end of the array.
Diffstat (limited to 'cmd-string.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-string.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 526cea9..e729fe5 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-string.c,v 1.25 2009/11/13 16:55:10 tcunha Exp $ */
+/* $Id: cmd-string.c,v 1.26 2009/11/18 01:24:33 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -151,10 +151,6 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
if (*cmdlist == NULL)
goto out;
- do
- xfree(argv[argc - 1]);
- while (--argc > 0);
-
rval = 0;
goto out;
case '~':
@@ -189,7 +185,7 @@ out:
if (argv != NULL) {
for (i = 0; i < argc; i++)
- xfree(argv[argc]);
+ xfree(argv[i]);
xfree(argv);
}