From e5da34e80a1cc6f5af480cc5343dd48d52c60a96 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 25 Nov 2008 15:54:56 +0000 Subject: [PATCH] Fix fp_get_pollfds() It was increasing i too early, and writing past the allocated structures. --- libfprint/poll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libfprint/poll.c b/libfprint/poll.c index a852905..f78b658 100644 --- a/libfprint/poll.c +++ b/libfprint/poll.c @@ -308,9 +308,10 @@ API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds) ret = g_malloc(sizeof(struct fp_pollfd) * cnt); i = 0; - while ((usbfd = usbfds[i++]) != NULL) { + while ((usbfd = usbfds[i]) != NULL) { ret[i].fd = usbfd->fd; ret[i].events = usbfd->events; + i++; } *pollfds = ret;