]> git.ozlabs.org Git - petitboot/commitdiff
Fix waiter alloc
authorGeoff Levand <geoffrey.levand@am.sony.com>
Thu, 22 Jan 2009 00:26:55 +0000 (16:26 -0800)
committerJeremy Kerr <jk@ozlabs.org>
Sun, 1 Feb 2009 00:42:29 +0000 (11:42 +1100)
Add the missing assignment of the global n_pollfds variable.
Fix a minor memory leak in waiter_poll().

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/waiter/waiter.c

index 21dd4a589650d207b65441e05b61a0aaf8255aa2..214dfda0b4786d7d42293e7ff25c406c7528814a 100644 (file)
@@ -54,9 +54,10 @@ int waiter_poll(void)
        static int n_pollfds;
        int i, rc;
 
        static int n_pollfds;
        int i, rc;
 
-       if (n_waiters > n_pollfds) {
+       if (n_waiters != n_pollfds) {
                pollfds = talloc_realloc(NULL, pollfds,
                                struct pollfd, n_waiters);
                pollfds = talloc_realloc(NULL, pollfds,
                                struct pollfd, n_waiters);
+               n_pollfds = n_waiters;
        }
 
        for (i = 0; i < n_waiters; i++) {
        }
 
        for (i = 0; i < n_waiters; i++) {