summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-16 11:15:44 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-16 11:15:44 +0000
commit9f6d685c05c9f71ba842f65fb2139ebbd30bd606 (patch)
tree6e9ca5c6c7a8e57446eaf52aee5e7c5db2f4627c /cmd-string.c
parent10e05f9867f8129c24596ca929952136e1bd496e (diff)
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')
-rw-r--r--cmd-string.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 7af34fb0..1a380e50 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -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);
}