aboutsummaryrefslogtreecommitdiff
path: root/src/or/microdesc.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-02 12:48:34 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-02 12:48:34 -0400
commit00ffccd9a6d9b7f484c2e421be33aea3975a2879 (patch)
treec0e01dfadc0a10feb98bbb517715c384ccacab1c /src/or/microdesc.c
parente3c143f5214b4a2d37dbb47940eaf2cc2e212f86 (diff)
downloadtor-00ffccd9a6d9b7f484c2e421be33aea3975a2879.tar.gz
tor-00ffccd9a6d9b7f484c2e421be33aea3975a2879.zip
Another clang analyzer complaint wrt HT_GENERATE
We're calling mallocfn() and reallocfn() in the HT_GENERATE macro with the result of a product. But that makes any sane analyzer worry about overflow. This patch keeps HT_GENERATE having its old semantics, since we aren't the only project using ht.h. Instead, define a HT_GENERATE2 that takes a reallocarrayfn.
Diffstat (limited to 'src/or/microdesc.c')
-rw-r--r--src/or/microdesc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index fdb549a9ac..ed586f37c2 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -57,9 +57,9 @@ microdesc_eq_(microdesc_t *a, microdesc_t *b)
HT_PROTOTYPE(microdesc_map, microdesc_t, node,
microdesc_hash_, microdesc_eq_);
-HT_GENERATE(microdesc_map, microdesc_t, node,
+HT_GENERATE2(microdesc_map, microdesc_t, node,
microdesc_hash_, microdesc_eq_, 0.6,
- malloc, realloc, free);
+ tor_reallocarray_, tor_free_)
/** Write the body of <b>md</b> into <b>f</b>, with appropriate annotations.
* On success, return the total number of bytes written, and set