diff options
author | Andreas Schneider <asn@samba.org> | 2018-08-09 15:58:32 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-08-23 10:39:16 +0200 |
commit | f1c2e6829a1abc2ebeb47b0a800c6928a344fd1a (patch) | |
tree | f370c9b38fd46de37e338f6265cc1bbb9e7cbaf5 /source3/client | |
parent | 98e7021744e1b22c49b40613058d22ab7bfe02d2 (diff) | |
download | samba-f1c2e6829a1abc2ebeb47b0a800c6928a344fd1a.tar.gz |
s3:client: Avoid a possible fd leak in do_get()
Found by covscan.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13567
Pair-Programmed-With: Justin Stephenson <jstephen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 3d32c0263b072e19335eba1451840284409ecb61)
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index f112b8c4ac1..25ba01d6216 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1160,6 +1160,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget) start = lseek(handle, 0, SEEK_END); if (start == -1) { d_printf("Error seeking local file\n"); + close(handle); return 1; } } @@ -1181,6 +1182,9 @@ static int do_get(const char *rname, const char *lname_in, bool reget) NULL); if(!NT_STATUS_IS_OK(status)) { d_printf("getattrib: %s\n", nt_errstr(status)); + if (newhandle) { + close(handle); + } return 1; } } @@ -1193,6 +1197,9 @@ static int do_get(const char *rname, const char *lname_in, bool reget) if (!NT_STATUS_IS_OK(status)) { d_fprintf(stderr, "parallel_read returned %s\n", nt_errstr(status)); + if (newhandle) { + close(handle); + } cli_close(targetcli, fnum); return 1; } |