aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-08-13 10:36:06 -0400
committerNick Mathewson <nickm@torproject.org>2014-08-13 10:39:56 -0400
commit2bfd92d0d170642fb12f53e5da208f318fdd632c (patch)
tree09da23f22e58e196fef9995e21b59aff3b555487 /src/common/container.h
parent5da821a8a3cfffc18f5a656852d98e69cff5dd8f (diff)
downloadtor-2bfd92d0d170642fb12f53e5da208f318fdd632c.tar.gz
tor-2bfd92d0d170642fb12f53e5da208f318fdd632c.zip
Apply coccinelle script to replace malloc(a*b)->calloc(a,b)
Diffstat (limited to 'src/common/container.h')
-rw-r--r--src/common/container.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/container.h b/src/common/container.h
index 0d31f2093b..08da34e07e 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -563,7 +563,7 @@ bitarray_init_zero(unsigned int n_bits)
{
/* round up to the next int. */
size_t sz = (n_bits+BITARRAY_MASK) >> BITARRAY_SHIFT;
- return tor_malloc_zero(sz*sizeof(unsigned int));
+ return tor_calloc(sz, sizeof(unsigned int));
}
/** Expand <b>ba</b> from holding <b>n_bits_old</b> to <b>n_bits_new</b>,
* clearing all new bits. Returns a possibly changed pointer to the
@@ -577,7 +577,7 @@ bitarray_expand(bitarray_t *ba,
char *ptr;
if (sz_new <= sz_old)
return ba;
- ptr = tor_realloc(ba, sz_new*sizeof(unsigned int));
+ ptr = tor_reallocarray(ba, sz_new, sizeof(unsigned int));
/* This memset does nothing to the older excess bytes. But they were
* already set to 0 by bitarry_init_zero. */
memset(ptr+sz_old*sizeof(unsigned int), 0,