aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.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/common/container.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/common/container.c')
-rw-r--r--src/common/container.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/container.c b/src/common/container.c
index 7481d31eb5..f7dfc69c2f 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -1052,13 +1052,13 @@ digestmap_entry_hash(const digestmap_entry_t *a)
HT_PROTOTYPE(strmap_impl, strmap_entry_t, node, strmap_entry_hash,
strmap_entries_eq)
-HT_GENERATE(strmap_impl, strmap_entry_t, node, strmap_entry_hash,
- strmap_entries_eq, 0.6, malloc, realloc, free)
+HT_GENERATE2(strmap_impl, strmap_entry_t, node, strmap_entry_hash,
+ strmap_entries_eq, 0.6, tor_reallocarray_, tor_free_)
HT_PROTOTYPE(digestmap_impl, digestmap_entry_t, node, digestmap_entry_hash,
digestmap_entries_eq)
-HT_GENERATE(digestmap_impl, digestmap_entry_t, node, digestmap_entry_hash,
- digestmap_entries_eq, 0.6, malloc, realloc, free)
+HT_GENERATE2(digestmap_impl, digestmap_entry_t, node, digestmap_entry_hash,
+ digestmap_entries_eq, 0.6, tor_reallocarray_, tor_free_)
/** Constructor to create a new empty map from strings to void*'s.
*/