#vulnerable code 
                              private static Map<RaftPeer, NettyRpcService> initRpcServices(
      Collection<RaftServer> servers, RaftConfiguration conf) {
    final Map<RaftPeer, NettyRpcService> peerRpcs = new HashMap<>();

    for (RaftServer s : servers) {
      final String address = getAddress(s.getId(), conf);
      final int port = RaftUtils.newInetSocketAddress(address).getPort();
      final NettyRpcService rpc = new NettyRpcService(port, s);
      peerRpcs.put(new RaftPeer(s.getId(), rpc.getInetSocketAddress()), rpc);
    }

    return peerRpcs;
  } 
                            #location 9 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              private static Map<RaftPeer, NettyRpcService> initRpcServices(
      Collection<RaftServer> servers, RaftConfiguration conf) {
    final Map<RaftPeer, NettyRpcService> peerRpcs = new HashMap<>();

    for (RaftServer s : servers) {
      final NettyRpcService rpc = newNettyRpcService(s, conf);
      peerRpcs.put(new RaftPeer(s.getId(), rpc.getInetSocketAddress()), rpc);
    }

    return peerRpcs;
  }