diff options
Diffstat (limited to 'src/common/container.c')
-rw-r--r-- | src/common/container.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c index 5ac16bdb1b..6bd8df689d 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -66,6 +66,8 @@ smartlist_set_capacity(smartlist_t *sl, int n) { if (n < sl->num_used) n = sl->num_used; + if (n < 1) + n = 1; if (sl->capacity != n) { sl->capacity = n; sl->list = tor_realloc(sl->list, sizeof(void*)*sl->capacity); |