From a6ee047fcb3cda94fd731b97d5eec26140c00b42 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 27 Feb 2008 17:50:36 -0800 Subject: [PATCH] Verify that os_get_time() does not fail before using the time value when registering an eloop timeout. --- src/utils/eloop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/eloop.c b/src/utils/eloop.c index 021c5161d..f988e947e 100644 --- a/src/utils/eloop.c +++ b/src/utils/eloop.c @@ -242,7 +242,10 @@ int eloop_register_timeout(unsigned int secs, unsigned int usecs, timeout = os_malloc(sizeof(*timeout)); if (timeout == NULL) return -1; - os_get_time(&timeout->time); + if (os_get_time(&timeout->time) < 0) { + os_free(timeout); + return -1; + } timeout->time.sec += secs; timeout->time.usec += usecs; while (timeout->time.usec >= 1000000) {