diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/channels.c b/channels.c index 1937b0244..218744d1a 100644 --- a/channels.c +++ b/channels.c | |||
@@ -229,12 +229,13 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
229 | if (found == -1) { | 229 | if (found == -1) { |
230 | /* There are no free slots. Take last+1 slot and expand the array. */ | 230 | /* There are no free slots. Take last+1 slot and expand the array. */ |
231 | found = channels_alloc; | 231 | found = channels_alloc; |
232 | channels_alloc += 10; | ||
233 | if (channels_alloc > 10000) | 232 | if (channels_alloc > 10000) |
234 | fatal("channel_new: internal error: channels_alloc %d " | 233 | fatal("channel_new: internal error: channels_alloc %d " |
235 | "too big.", channels_alloc); | 234 | "too big.", channels_alloc); |
235 | channels = xrealloc(channels, | ||
236 | (channels_alloc + 10) * sizeof(Channel *)); | ||
237 | channels_alloc += 10; | ||
236 | debug2("channel: expanding %d", channels_alloc); | 238 | debug2("channel: expanding %d", channels_alloc); |
237 | channels = xrealloc(channels, channels_alloc * sizeof(Channel *)); | ||
238 | for (i = found; i < channels_alloc; i++) | 239 | for (i = found; i < channels_alloc; i++) |
239 | channels[i] = NULL; | 240 | channels[i] = NULL; |
240 | } | 241 | } |