[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Make sure initialized_at is initialized before use.



commit 6ba415d4000712aecaf3d11903db5699f143569d
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jul 19 11:36:43 2016 +0200

    Make sure initialized_at is initialized before use.
---
 src/common/compat_time.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/common/compat_time.c b/src/common/compat_time.c
index de39566..b7d69cf 100644
--- a/src/common/compat_time.c
+++ b/src/common/compat_time.c
@@ -466,6 +466,10 @@ uint64_t
 monotime_absolute_nsec(void)
 {
   monotime_t now;
+  if (BUG(monotime_initialized == 0)) {
+    monotime_init();
+  }
+
   monotime_get(&now);
   return monotime_diff_nsec(&initialized_at, &now);
 }
@@ -486,6 +490,10 @@ monotime_absolute_msec(void)
 uint64_t
 monotime_coarse_absolute_nsec(void)
 {
+  if (BUG(monotime_initialized == 0)) {
+    monotime_init();
+  }
+
   monotime_coarse_t now;
   monotime_coarse_get(&now);
   return monotime_coarse_diff_nsec(&initialized_at_coarse, &now);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits