summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-26 06:28:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-26 06:28:15 -0700
commitbe80aec475e95c31225375c42a6f1e0808056a1c (patch)
tree60ae8b744c62a01e75d27779b2aef4de378ac1e5
parentaf9a912dc2bb853f32382cd1f9e7df3a673d50b4 (diff)
downloadtxr-be80aec475e95c31225375c42a6f1e0808056a1c.tar.gz
txr-be80aec475e95c31225375c42a6f1e0808056a1c.tar.bz2
txr-be80aec475e95c31225375c42a6f1e0808056a1c.zip
ffi: bugfix: varray alloc not accounting for null term.
* ffi.c (ffi_varray_alloc): Add tft->null_term to length.
-rw-r--r--ffi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ffi.c b/ffi.c
index f9a4ebc3..049c16d1 100644
--- a/ffi.c
+++ b/ffi.c
@@ -381,7 +381,7 @@ static mem_t *ffi_fixed_alloc(struct txr_ffi_type *tft, val obj, val self)
static mem_t *ffi_varray_alloc(struct txr_ffi_type *tft, val obj, val self)
{
- cnum len = c_num(length(obj));
+ cnum len = c_num(length(obj)) + tft->null_term;
val eltype = tft->eltype;
struct txr_ffi_type *etft = ffi_type_struct(eltype);
return chk_calloc(len, etft->size);