From 70c668cf9a36b7e9b14387b3554a4b95abd4f60b Mon Sep 17 00:00:00 2001 From: dtucker Date: Wed, 29 Mar 2023 00:59:08 +0000 Subject: [PATCH] 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@ --- usr.bin/ssh/sftp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 * @@ -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) -- 2.20.1