summaryrefslogtreecommitdiffstats
path: root/src/vector.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vector.c')
-rw-r--r--src/vector.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vector.c b/src/vector.c
index aeeeebb..8cfecd4 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -57,8 +57,13 @@ void _fastd_vector_resize(fastd_vector_desc_t *desc, void **data, size_t n, size
n = n*3/2;
}
- while (alloc < n)
+ while (alloc < n) {
alloc <<= 1;
+ if (!alloc) {
+ errno = EOVERFLOW;
+ exit_errno("memory allocation error");
+ }
+ }
if (alloc != desc->allocated) {
desc->allocated = alloc;