aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.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/rephist.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/rephist.c')
-rw-r--r--src/or/rephist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 2f8ebcb5b3..cd92b0adc5 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -2724,8 +2724,8 @@ bidi_map_ent_hash(const bidi_map_entry_t *entry)
HT_PROTOTYPE(bidimap, bidi_map_entry_t, node, bidi_map_ent_hash,
bidi_map_ent_eq);
-HT_GENERATE(bidimap, bidi_map_entry_t, node, bidi_map_ent_hash,
- bidi_map_ent_eq, 0.6, malloc, realloc, free);
+HT_GENERATE2(bidimap, bidi_map_entry_t, node, bidi_map_ent_hash,
+ bidi_map_ent_eq, 0.6, tor_reallocarray_, tor_free_)
/* DOCDOC bidi_map_free */
static void