From: dtucker Date: Wed, 29 Mar 2023 00:59:08 +0000 (+0000) Subject: Plug another potential mem leak in process_put. It allocates abs_dst X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=70c668cf9a36b7e9b14387b3554a4b95abd4f60b;p=openbsd 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@ --- 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)