[2/9] petitboot: Fix waiter alloc

Submitted by Geoff Levand on Jan. 22, 2009, 12:26 a.m.

Details

Message ID 20090122002653.318873144@am.sony.com
State Accepted
Delegated to: Jeremy Kerr
Headers show

Commit Message

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 hide | download patch | download mbox

--- 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++) {