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
commite9c8551f35f7f3042271dd4abba6909bc23aa229 (patch)
tree60ae8b744c62a01e75d27779b2aef4de378ac1e5
parent0a562b428c0fb9651fcfe03ae0d6e40262e3695a (diff)
downloadtxr-e9c8551f35f7f3042271dd4abba6909bc23aa229.tar.gz
txr-e9c8551f35f7f3042271dd4abba6909bc23aa229.tar.bz2
txr-e9c8551f35f7f3042271dd4abba6909bc23aa229.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);