Fix fp_get_pollfds()

It was increasing i too early, and writing past the allocated
structures.
This commit is contained in:
Bastien Nocera 2008-11-25 15:54:56 +00:00 committed by Daniel Drake
parent d816fed5c3
commit e5da34e80a

View file

@ -308,9 +308,10 @@ API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds)
ret = g_malloc(sizeof(struct fp_pollfd) * cnt); ret = g_malloc(sizeof(struct fp_pollfd) * cnt);
i = 0; i = 0;
while ((usbfd = usbfds[i++]) != NULL) { while ((usbfd = usbfds[i]) != NULL) {
ret[i].fd = usbfd->fd; ret[i].fd = usbfd->fd;
ret[i].events = usbfd->events; ret[i].events = usbfd->events;
i++;
} }
*pollfds = ret; *pollfds = ret;