Fix a couple of memory leaks in the cli_establish_connection() code's failure
authorAndrew Bartlett <abartlet@samba.org>
Sun, 20 Jan 2002 07:13:05 +0000 (07:13 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 20 Jan 2002 07:13:05 +0000 (07:13 +0000)
case.

Thanks to Nigel Williams <nigel@wednesday.demon.co.uk> for spotting these!

Andrew Bartlett
(This used to be commit 20e0b562283f75606ac9a36f3f104c6aaa294c40)

source3/libsmb/cliconnect.c

index 08d9f3b3826ee44b67eed4a7fcf7dbcf3e7f9fb9..86ff6b5c9250724e6811b84ee8a3ede4cfd70b31 100644 (file)
@@ -1223,6 +1223,7 @@ again:
        }
        
        if (cli_set_port(cli, port) != port) {
        }
        
        if (cli_set_port(cli, port) != port) {
+               cli_shutdown(cli);
                return NT_STATUS_UNSUCCESSFUL;
        }
 
                return NT_STATUS_UNSUCCESSFUL;
        }
 
@@ -1235,6 +1236,7 @@ again:
        {
                DEBUG(1,("cli_establish_connection: failed to connect to %s (%s)\n",
                         nmb_namestr(&called), inet_ntoa(*dest_ip)));
        {
                DEBUG(1,("cli_establish_connection: failed to connect to %s (%s)\n",
                         nmb_namestr(&called), inet_ntoa(*dest_ip)));
+               cli_shutdown(cli);
                return NT_STATUS_UNSUCCESSFUL;
        }
 
                return NT_STATUS_UNSUCCESSFUL;
        }