summaryrefslogtreecommitdiff
path: root/source4/client
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-02-20 09:23:37 +0100
committerAlexander Bokovoy <ab@samba.org>2013-02-22 16:36:13 +0100
commitb91a20f704363374bc37aaa75e5d2c80f7997017 (patch)
tree812bc448a4b0f55139a775528f1e6f87e1f77755 /source4/client
parent34ad9756d73bc4203281ab39ff68489aab1b44e9 (diff)
downloadsamba-b91a20f704363374bc37aaa75e5d2c80f7997017.tar.gz
samba-b91a20f704363374bc37aaa75e5d2c80f7997017.tar.bz2
samba-b91a20f704363374bc37aaa75e5d2c80f7997017.zip
s4-client: Don't leak file descriptor.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source4/client')
-rw-r--r--source4/client/client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index 1dc5b6dd01..5e8f5ca8ae 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -722,6 +722,7 @@ static int do_get(struct smbclient_context *ctx, char *rname, const char *p_lnam
start = lseek(handle, 0, SEEK_END);
if (start == -1) {
d_printf("Error seeking local file\n");
+ close(handle);
return 1;
}
}
@@ -741,6 +742,9 @@ static int do_get(struct smbclient_context *ctx, char *rname, const char *p_lnam
NT_STATUS_IS_ERR(smbcli_getattrE(ctx->cli->tree, fnum,
&attr, &size, NULL, NULL, NULL))) {
d_printf("getattrib: %s\n",smbcli_errstr(ctx->cli->tree));
+ if (newhandle) {
+ close(handle);
+ }
return 1;
}
@@ -750,6 +754,9 @@ static int do_get(struct smbclient_context *ctx, char *rname, const char *p_lnam
if(!(data = (uint8_t *)malloc(read_size))) {
d_printf("malloc fail for size %d\n", read_size);
smbcli_close(ctx->cli->tree, fnum);
+ if (newhandle) {
+ close(handle);
+ }
return 1;
}