Fix a couple of memory leaks in the cli_establish_connection() code's failure
[ira/wip.git] / source3 / libsmb / cliconnect.c
index 08d9f3b3826ee44b67eed4a7fcf7dbcf3e7f9fb9..86ff6b5c9250724e6811b84ee8a3ede4cfd70b31 100644 (file)
@@ -1223,6 +1223,7 @@ again:
        }
        
        if (cli_set_port(cli, port) != port) {
+               cli_shutdown(cli);
                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)));
+               cli_shutdown(cli);
                return NT_STATUS_UNSUCCESSFUL;
        }