diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2023-03-29 02:59:08 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2023-03-29 03:22:33 +0200 |
commit | c3da05d95922f5550bcc7815e799474d6a160175 (patch) | |
tree | c3210a71bfe6c53604aae185133563fcfb26ddf1 /sftp.c | |
parent | upstream: fix memory leak; Coverity CID 291848 (diff) | |
download | openssh-c3da05d95922f5550bcc7815e799474d6a160175.tar.xz openssh-c3da05d95922f5550bcc7815e799474d6a160175.zip |
upstream: Plug 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@
OpenBSD-Commit-ID: a01616503a185519b16f00dde25d34ceaf4ae1a3
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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> * @@ -769,6 +769,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) |