mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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>
This commit is contained in:
parent
d4fb124adf
commit
3d32c0263b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user