[tor-commits] [tor/master] Avoid a scan_build warning in dirvote_get_intermediate_param_value

nickm at torproject.org nickm at torproject.org
Fri Jul 7 17:06:07 UTC 2017


commit 67b6ba6f2f2cb95ab534052a0e25eb4f5185e41c
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jul 7 11:07:30 2017 -0400

    Avoid a scan_build warning in dirvote_get_intermediate_param_value
    
    Fixes bug 21495.
---
 src/or/dirvote.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index f5e29eb..11cd020 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -737,12 +737,12 @@ dirvote_get_intermediate_param_value(const smartlist_t *param_list,
     }
   } SMARTLIST_FOREACH_END(k_v_pair);
 
-  if (n_found == 1)
+  if (n_found == 1) {
     return value;
-  else if (BUG(n_found > 1))
-    return default_val;
-  else
+  } else {
+    tor_assert_nonfatal(n_found == 0);
     return default_val;
+  }
 }
 
 /** Minimum number of directory authorities voting for a parameter to





More information about the tor-commits mailing list