From 063a474fe055cadcb7f7f64e5061ed65d506c407 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Wed, 18 Nov 2009 01:24:33 +0000 Subject: [PATCH] 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. --- cmd-string.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cmd-string.c b/cmd-string.c index 69cc9b6e..2ca21983 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 @@ -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); }