#vulnerable code 
                                @Override
    public List<ProviderGroup> subscribe(final ConsumerConfig config) {
        String appName = config.getAppName();
        if (!registryConfig.isSubscribe()) {
            // 注册中心不订阅
            if (LOGGER.isInfoEnabled(appName)) {
                LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_REGISTRY_IGNORE));
            }
            return null;
        }
        // 注册Consumer节点
        if (config.isRegister()) {
            try {
                String consumerPath = buildConsumerPath(rootPath, config);
                String url = ZookeeperRegistryHelper.convertConsumerToUrl(config);
                String encodeUrl = URLEncoder.encode(url, "UTF-8");
                getAndCheckZkClient().create().creatingParentContainersIfNeeded()
                    .withMode(CreateMode.EPHEMERAL) // Consumer临时节点
                    .forPath(consumerPath + CONTEXT_SEP + encodeUrl);
                consumerUrls.put(config, url);
            } catch (Exception e) {
                throw new SofaRpcRuntimeException("Failed to register consumer to zookeeperRegistry!", e);
            }
        }
        if (config.isSubscribe()) {
            // 订阅配置
            if (!INTERFACE_CONFIG_CACHE.containsKey(buildConfigPath(rootPath, config))) {
                //订阅接口级配置
                subscribeConfig(config, config.getConfigListener());
            }
            if (!INTERFACE_OVERRIDE_CACHE.containsKey(buildOverridePath(rootPath, config))) {
                //订阅IP级配置
                subscribeOverride(config, config.getConfigListener());
            }

            // 订阅Providers节点
            try {
                if (providerObserver == null) { // 初始化
                    providerObserver = new ZookeeperProviderObserver();
                }
                final String providerPath = buildProviderPath(rootPath, config);
                if (LOGGER.isInfoEnabled(appName)) {
                    LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_ROUTE_REGISTRY_SUB, providerPath));
                }
                // 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件
                ProviderInfoListener providerInfoListener = config.getProviderInfoListener();
                providerObserver.addProviderListener(config, providerInfoListener);
                // TODO 换成监听父节点变化（只是监听变化了，而不通知变化了什么，然后客户端自己来拉数据的）
                PathChildrenCache pathChildrenCache = new PathChildrenCache(zkClient, providerPath, true);
                pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() {
                    @Override
                    public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
                        if (LOGGER.isDebugEnabled(config.getAppName())) {
                            LOGGER.debugWithApp(config.getAppName(),
                                "Receive zookeeper event: " + "type=[" + event.getType() + "]");
                        }
                        switch (event.getType()) {
                            case CHILD_ADDED: //加了一个provider
                                providerObserver.addProvider(config, providerPath, event.getData());
                                break;
                            case CHILD_REMOVED: //删了一个provider
                                providerObserver.removeProvider(config, providerPath, event.getData());
                                break;
                            case CHILD_UPDATED: // 更新一个Provider
                                providerObserver.updateProvider(config, providerPath, event.getData());
                                break;
                            default:
                                break;
                        }
                    }
                });
                pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
                List<ProviderInfo> providerInfos = ZookeeperRegistryHelper.convertUrlsToProviders(
                    providerPath, pathChildrenCache.getCurrentData());
                List<ProviderInfo> matchProviders = ZookeeperRegistryHelper.matchProviderInfos(config, providerInfos);
                return Collections.singletonList(new ProviderGroup().addAll(matchProviders));
            } catch (Exception e) {
                throw new SofaRpcRuntimeException("Failed to subscribe provider from zookeeperRegistry!", e);
            }
        }
        return null;
    } 
                            #location 74 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Override
    public List<ProviderGroup> subscribe(final ConsumerConfig config) {
        String appName = config.getAppName();
        if (!registryConfig.isSubscribe()) {
            // 注册中心不订阅
            if (LOGGER.isInfoEnabled(appName)) {
                LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_REGISTRY_IGNORE));
            }
            return null;
        }
        // 注册Consumer节点
        if (config.isRegister()) {
            try {
                String consumerPath = buildConsumerPath(rootPath, config);
                String url = ZookeeperRegistryHelper.convertConsumerToUrl(config);
                String encodeUrl = URLEncoder.encode(url, "UTF-8");
                getAndCheckZkClient().create().creatingParentContainersIfNeeded()
                    .withMode(CreateMode.EPHEMERAL) // Consumer临时节点
                    .forPath(consumerPath + CONTEXT_SEP + encodeUrl);
                consumerUrls.put(config, url);
            } catch (Exception e) {
                throw new SofaRpcRuntimeException("Failed to register consumer to zookeeperRegistry!", e);
            }
        }
        if (config.isSubscribe()) {
            // 订阅配置
            if (!INTERFACE_CONFIG_CACHE.containsKey(buildConfigPath(rootPath, config))) {
                //订阅接口级配置
                subscribeConfig(config, config.getConfigListener());
            }
            if (!INTERFACE_OVERRIDE_CACHE.containsKey(buildOverridePath(rootPath, config))) {
                //订阅IP级配置
                subscribeOverride(config, config.getConfigListener());
            }

            // 订阅Providers节点
            try {
                if (providerObserver == null) { // 初始化
                    providerObserver = new ZookeeperProviderObserver();
                }
                final String providerPath = buildProviderPath(rootPath, config);
                if (LOGGER.isInfoEnabled(appName)) {
                    LOGGER.infoWithApp(appName, LogCodes.getLog(LogCodes.INFO_ROUTE_REGISTRY_SUB, providerPath));
                }
                PathChildrenCache pathChildrenCache = INTERFACE_PROVIDER_CACHE.get(config);
                if (pathChildrenCache == null) {
                    // 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件
                    ProviderInfoListener providerInfoListener = config.getProviderInfoListener();
                    providerObserver.addProviderListener(config, providerInfoListener);
                    // TODO 换成监听父节点变化（只是监听变化了，而不通知变化了什么，然后客户端自己来拉数据的）
                    pathChildrenCache = new PathChildrenCache(zkClient, providerPath, true);
                    final PathChildrenCache finalPathChildrenCache = pathChildrenCache;
                    pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() {
                        @Override
                        public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
                            if (LOGGER.isDebugEnabled(config.getAppName())) {
                                LOGGER.debugWithApp(config.getAppName(),
                                    "Receive zookeeper event: " + "type=[" + event.getType() + "]");
                            }
                            switch (event.getType()) {
                                case CHILD_ADDED: //加了一个provider
                                    providerObserver.addProvider(config, providerPath, event.getData(),
                                        finalPathChildrenCache.getCurrentData());
                                    break;
                                case CHILD_REMOVED: //删了一个provider
                                    providerObserver.removeProvider(config, providerPath, event.getData(),
                                        finalPathChildrenCache.getCurrentData());
                                    break;
                                case CHILD_UPDATED: // 更新一个Provider
                                    providerObserver.updateProvider(config, providerPath, event.getData(),
                                        finalPathChildrenCache.getCurrentData());
                                    break;
                                default:
                                    break;
                            }
                        }
                    });
                    pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
                    INTERFACE_PROVIDER_CACHE.put(config, pathChildrenCache);
                }
                List<ProviderInfo> providerInfos = ZookeeperRegistryHelper.convertUrlsToProviders(
                    providerPath, pathChildrenCache.getCurrentData());
                List<ProviderInfo> matchProviders = ZookeeperRegistryHelper.matchProviderInfos(config, providerInfos);
                return Collections.singletonList(new ProviderGroup().addAll(matchProviders));
            } catch (Exception e) {
                throw new SofaRpcRuntimeException("Failed to subscribe provider from zookeeperRegistry!", e);
            }
        }
        return null;
    }