#vulnerable code 
                              public static int numberOfListeners(String zkAddr, String path) throws Exception
  {
    int count = 0;
    String splits[] = zkAddr.split(":");
    Socket sock = new Socket(splits[0], Integer.parseInt(splits[1]));
    PrintWriter out = new PrintWriter(sock.getOutputStream(), true);
    BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));

    out.println("wchp");

    String line = in.readLine();
    while (line != null)
    {
      // System.out.println(line);
      if (line.equals(path))
      {
        // System.out.println("match: " + line);

        String nextLine = in.readLine();
        if (nextLine == null)
        {
          break;
        }
        // System.out.println(nextLine);
        while (nextLine.startsWith("\t0x"))
        {
          count++;
          nextLine = in.readLine();
          if (nextLine == null)
          {
            break;
          }
        }
      }
      line = in.readLine();
    }
    sock.close();
    return count;
  } 
                            #location 38 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              public static int numberOfListeners(String zkAddr, String path) throws Exception
  {
	  Map<String, Set<String>> listenerMap = getListenersByZkPath(zkAddr);
	  if (listenerMap.containsKey(path)) {
		  return listenerMap.get(path).size();
	  }
	  return 0;
  }