summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2011-11-16 12:24:28 +0000
committeroga <oga@openbsd.org>2011-11-16 12:24:28 +0000
commit018d471f31dd57bb5b242d39d0d10d081ec28f0a (patch)
tree6cd26d9f41a7427d70aba1db7889ba3b6dc9bfe6
parentImprove flag setting ioctl so that bulk updates are requested (diff)
downloadwireguard-openbsd-018d471f31dd57bb5b242d39d0d10d081ec28f0a.tar.xz
wireguard-openbsd-018d471f31dd57bb5b242d39d0d10d081ec28f0a.zip
Don't leak list in complete_cmd_parse if there are no commands found.
Discovered when I was ``borrowing'' this code for something else. ok djm@
-rw-r--r--usr.bin/ssh/sftp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index dfa5f4b3c33..6fa1e4005ec 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.133 2011/09/22 06:29:03 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.134 2011/11/16 12:24:28 oga Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -1607,8 +1607,10 @@ complete_cmd_parse(EditLine *el, char *cmd, int lastarg, char quote,
}
list[count] = NULL;
- if (count == 0)
+ if (count == 0) {
+ xfree(list);
return 0;
+ }
/* Complete ambigious command */
tmp = complete_ambiguous(cmd, list, count);