similar memory leak patch for wait_fds