Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/wpa/dist/src/utils Size the kevent receive buff...



details:   https://anonhg.NetBSD.org/src/rev/5892324b50a5
branches:  trunk
changeset: 343078:5892324b50a5
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Jan 22 18:01:05 2016 +0000

description:
Size the kevent receive buffer correctly.

diffstat:

 external/bsd/wpa/dist/src/utils/eloop.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 013288b565a5 -r 5892324b50a5 external/bsd/wpa/dist/src/utils/eloop.c
--- a/external/bsd/wpa/dist/src/utils/eloop.c   Fri Jan 22 17:56:20 2016 +0000
+++ b/external/bsd/wpa/dist/src/utils/eloop.c   Fri Jan 22 18:01:05 2016 +0000
@@ -254,6 +254,9 @@
 #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 @@
 #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 */



Home | Main Index | Thread Index | Old Index