Patchwork [2/9] petitboot: Fix waiter alloc

login
register
mail settings
Submitter Geoff Levand
Date Jan. 22, 2009, 12:26 a.m.
Message ID <20090122002653.318873144@am.sony.com>
Download mbox | patch
Permalink /patch/19741/
State Accepted
Delegated to: Jeremy Kerr
Headers show

Comments

Geoff Levand - Jan. 22, 2009, 12:26 a.m.
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>
---
 lib/waiter.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

--- a/lib/waiter.c
+++ b/lib/waiter.c
@@ -54,9 +54,10 @@  int waiter_poll(void)
 	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);
+		n_pollfds = n_waiters;
 	}
 
 	for (i = 0; i < n_waiters; i++) {