for (i = 0; i < channels_alloc; i++)
for (found = -1, i = 0; i < channels_alloc; i++)
int channel_allocate(int type, int sock, char *remote_name){  int i, old_channels;  /* Update the maximum file descriptor value. */  if (sock > channel_max_fd_value)    channel_max_fd_value = sock;  /* Do initial allocation if this is the first call. */  if (channels_alloc == 0)    {      channels_alloc = 10;      channels = xmalloc(channels_alloc * sizeof(Channel));      for (i = 0; i < channels_alloc; i++)	channels[i].type = SSH_CHANNEL_FREE;      /* Kludge: arrange a call to channel_stop_listening if we terminate	 with fatal(). */      fatal_add_cleanup((void (*)(void *))channel_stop_listening, NULL);    }  /* Try to find a free slot where to put the new channel. */  for (i = 0; i < channels_alloc; i++)    if (channels[i].type == SSH_CHANNEL_FREE)      {	/* Found a free slot.  Initialize the fields and return its number. */	buffer_init(&channels[i].input);	buffer_init(&channels[i].output);	channels[i].self = i;	channels[i].type = type;	channels[i].x11 = 0;	channels[i].sock = sock;	channels[i].remote_id = -1;	channels[i].remote_name = remote_name;        chan_init_iostates(&channels[i]);	return i;      }  /* There are no free slots.  Must expand the array. */  old_channels = channels_alloc;  channels_alloc += 10;  channels = xrealloc(channels, channels_alloc * sizeof(Channel));  for (i = old_channels; i < channels_alloc; i++)    channels[i].type = SSH_CHANNEL_FREE;  /* We know that the next one after the old maximum channel number is now     available.  Initialize and return its number. */  buffer_init(&channels[old_channels].input);  buffer_init(&channels[old_channels].output);  channels[old_channels].self = old_channels;  channels[old_channels].type = type;  channels[old_channels].x11 = 0;  channels[old_channels].sock = sock;  channels[old_channels].remote_id = -1;  channels[old_channels].remote_name = remote_name;  chan_init_iostates(&channels[old_channels]);  return old_channels;}