summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2023-03-29 00:59:09 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2023-03-29 00:59:09 +0000
commit787e0083a435127caa0203ae0ee9b883cf3cb1ff (patch)
tree90b6c65e716e118a94e1cae86817e32ecc55fbf2 /usr.bin/ssh
parent1e8bf663ea0c967a34b2612cf95f9638c1c8de7f (diff)
Plug another potential mem leak in process_put. It allocates abs_dst
inside a loop but only frees it on exit, so free inside the loop if necessary. Coverity CID 291837, ok djm@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/sftp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index d0b8f36c24d..fb4a50bba44 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.230 2023/03/28 07:44:32 dtucker Exp $ */
+/* $OpenBSD: sftp.c,v 1.231 2023/03/29 00:59:08 dtucker Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -748,6 +748,8 @@ process_put(struct sftp_conn *conn, const char *src, const char *dst,
goto out;
}
+ free(abs_dst);
+ abs_dst = NULL;
if (g.gl_matchc == 1 && tmp_dst) {
/* If directory specified, append filename */
if (dst_is_dir)