Module Name:    src
Committed By:   roy
Date:           Fri Jan 22 18:01:05 UTC 2016

Modified Files:
        src/external/bsd/wpa/dist/src/utils: eloop.c

Log Message:
Size the kevent receive buffer correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/wpa/dist/src/utils/eloop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/wpa/dist/src/utils/eloop.c
diff -u src/external/bsd/wpa/dist/src/utils/eloop.c:1.9 src/external/bsd/wpa/dist/src/utils/eloop.c:1.10
--- src/external/bsd/wpa/dist/src/utils/eloop.c:1.9	Wed Jan 20 17:03:35 2016
+++ src/external/bsd/wpa/dist/src/utils/eloop.c	Fri Jan 22 18:01:05 2016
@@ -254,6 +254,9 @@ static int eloop_sock_table_add_sock(str
 #ifdef CONFIG_ELOOP_EPOLL
 	struct epoll_event *temp_events;
 #endif /* CONFIG_ELOOP_EPOLL */
+#ifdef CONFIG_ELOOP_KQUEUE
+	struct kevent *temp_events;
+#endif /* CONFIG_ELOOP_EPOLL */
 #if defined(CONFIG_ELOOP_EPOLL) || defined(CONFIG_ELOOP_KQUEUE)
 	struct eloop_sock *temp_table;
 	int next;
@@ -325,15 +328,15 @@ static int eloop_sock_table_add_sock(str
 #ifdef CONFIG_ELOOP_KQUEUE
 	if (eloop.count + 1 > eloop.kqueue_nevents) {
 		next = eloop.kqueue_nevents == 0 ? 8 : eloop.kqueue_nevents * 2;
-		os_free(eloop.kqueue_events);
-		eloop.kqueue_events = os_malloc(next *
-					        sizeof(eloop.kqueue_events));
-		if (eloop.kqueue_events == NULL) {
+		temp_events = os_malloc(next * sizeof(*temp_events));
+		if (temp_events == NULL) {
 			wpa_printf(MSG_ERROR, "%s: malloc for kqueue failed. "
 				   "%s\n", __func__, strerror(errno));
 			return -1;
 		}
 
+		os_free(eloop.kqueue_events);
+		eloop.kqueue_events = temp_events;
 		eloop.kqueue_nevents = next;
 	}
 #endif /* CONFIG_ELOOP_KQUEUE */

Reply via email to