diff options
author | Andreas Schneider <asn@samba.org> | 2018-08-09 15:58:32 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-08-11 01:49:16 +0200 |
commit | 3d32c0263b072e19335eba1451840284409ecb61 (patch) | |
tree | 8eb17461edfcc68f96f4dd7b842258b6d8f0a097 /source3/client | |
parent | d4fb124adfc10de8b7eb1f72b74d7ca83f8415dd (diff) | |
download | samba-3d32c0263b072e19335eba1451840284409ecb61.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>
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; } |