From a17a13f7ce27c316c4304ddb6e33de1df6be86ca Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 30 Nov 2007 21:57:43 -0800 Subject: Fix missing error cleanup noticed by Derrell. Jeremy. (This used to be commit 37f00926c29c22f27e7192c1fff0a08ce136cb86) --- source3/libsmb/libsmbclient.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3') 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)); -- cgit