Commit 698a6a9d authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix/moduselect: poll.register(): Reuse freed entries in poll array.

parent 19920e25
......@@ -58,7 +58,15 @@ STATIC mp_obj_t poll_register(uint n_args, const mp_obj_t *args) {
if (self->len < self->alloc) {
i = self->len++;
} else {
assert(0);
struct pollfd *entries = self->entries;
for (i = 0; i < self->len; i++, entries++) {
if (entries->fd == -1) {
break;
}
}
if (entries->fd != -1) {
assert(0);
}
}
self->entries[i].fd = mp_obj_get_int(args[1]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment