summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2023-02-27 22:12:41 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2023-02-27 22:12:41 +0000
commitd0a8a99f1e34f49cc387f71b27791316ae8c2f22 (patch)
tree6f3bb34e2d0030c9fbf5c081c0f85dca23cdde95 /usr.bin
parent78c6ab628ab7c421958b46de7ec4e2dbc62ef417 (diff)
Plug mem leak on globbed ls error path. Spotted by Coverity, ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sftp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index 7654fedad7c..2cd3aa257a3 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.225 2023/01/05 05:49:13 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.226 2023/02/27 22:12:40 dtucker Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -1003,6 +1003,7 @@ do_globbed_ls(struct sftp_conn *conn, const char *path,
if (lflag & LS_LONG_VIEW) {
if (g.gl_statv[i] == NULL) {
error("no stat information for %s", fname);
+ free(fname);
continue;
}
lname = ls_file(fname, g.gl_statv[i], 1,