summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-01-08 18:51:55 -0800
committerJeremy Allison <jra@samba.org>2008-01-08 18:51:55 -0800
commit3eb2cfc1ad3e7592ce3711265507a6a1c4253280 (patch)
tree1d102b35693405661843b12283858be9c711edbc /source3/libsmb
parentb47d491489ae6161f0c04378ed15dc1a54a166e1 (diff)
downloadsamba-3eb2cfc1ad3e7592ce3711265507a6a1c4253280.tar.gz
samba-3eb2cfc1ad3e7592ce3711265507a6a1c4253280.tar.bz2
samba-3eb2cfc1ad3e7592ce3711265507a6a1c4253280.zip
Fix CID 461 - resource leak on error.
Jeremy. (This used to be commit eea07b0c83985af60395f8a31de5bac4e5398cff)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clidfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 77419b4a1a..16582f8049 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -156,6 +156,9 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
/* have to open a new connection */
if (!(c=cli_initialise()) || (cli_set_port(c, port) != port)) {
d_printf("Connection to %s failed\n", server_n);
+ if (c) {
+ cli_shutdown(c);
+ }
return NULL;
}
status = cli_connect(c, server_n, &ss);
@@ -163,6 +166,7 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
d_printf("Connection to %s failed (Error %s)\n",
server_n,
nt_errstr(status));
+ cli_shutdown(c);
return NULL;
}