diff options
author | Jeremy Allison <jra@samba.org> | 2007-11-30 21:57:43 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-11-30 21:57:43 -0800 |
commit | a17a13f7ce27c316c4304ddb6e33de1df6be86ca (patch) | |
tree | 02aaf56d41b28580dedd8defde00766fa2941957 | |
parent | d19861e29d5e46821548dc54d069cfdf625f08b4 (diff) | |
download | samba-a17a13f7ce27c316c4304ddb6e33de1df6be86ca.tar.gz samba-a17a13f7ce27c316c4304ddb6e33de1df6be86ca.tar.bz2 samba-a17a13f7ce27c316c4304ddb6e33de1df6be86ca.zip |
Fix missing error cleanup noticed by Derrell.
Jeremy.
(This used to be commit 37f00926c29c22f27e7192c1fff0a08ce136cb86)
-rw-r--r-- | source3/libsmb/libsmbclient.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 3990a29f4a..26ff339a1a 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -2777,7 +2777,6 @@ smbc_opendir_ctx(SMBCCTX *context, struct ip_service *ip_list; struct ip_service server_addr; struct user_auth_info u_info; - struct cli_state *cli; if (share[0] != (char)0 || path[0] != (char)0) { @@ -2838,6 +2837,7 @@ smbc_opendir_ctx(SMBCCTX *context, for (i = 0; i < count && i < max_lmb_count; i++) { char addr[INET6_ADDRSTRLEN]; char *wg_ptr = NULL; + struct cli_state *cli = NULL; print_sockaddr(addr, sizeof(addr), &ip_list[i].ss); DEBUG(99, ("Found master browser %d of %d: %s\n", @@ -2850,17 +2850,20 @@ smbc_opendir_ctx(SMBCCTX *context, &wg_ptr); /* cli == NULL is the master browser refused to talk or could not be found */ - if ( !cli ) + if (!cli) { continue; + } workgroup = talloc_strdup(frame, wg_ptr); server = talloc_strdup(frame, cli->desthost); + + cli_shutdown(cli); + if (!workgroup || !server) { errno = ENOMEM; TALLOC_FREE(frame); return NULL; } - cli_shutdown(cli); DEBUG(4, ("using workgroup %s %s\n", workgroup, server)); |