aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/container.c')
-rw-r--r--src/common/container.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/container.c b/src/common/container.c
index b937d544fc..9bbb9730c6 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -34,7 +34,7 @@ smartlist_new(void)
smartlist_t *sl = tor_malloc(sizeof(smartlist_t));
sl->num_used = 0;
sl->capacity = SMARTLIST_DEFAULT_CAPACITY;
- sl->list = tor_malloc(sizeof(void *) * sl->capacity);
+ sl->list = tor_calloc(sizeof(void *), sl->capacity);
return sl;
}
@@ -77,7 +77,8 @@ smartlist_ensure_capacity(smartlist_t *sl, int size)
higher *= 2;
}
sl->capacity = higher;
- sl->list = tor_realloc(sl->list, sizeof(void*)*((size_t)sl->capacity));
+ sl->list = tor_reallocarray(sl->list, sizeof(void *),
+ ((size_t)sl->capacity));
}
}