diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-18 20:11:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-18 20:11:55 -0700 |
commit | 4a5b6f32a7a38a700f42848877d3719b73452dcb (patch) | |
tree | 13b708a26dfd586dfcf580c6f5d7a941a0a03742 | |
parent | fd6324c9b82117399bc7cfa189f26c5fc615141c (diff) | |
download | txr-4a5b6f32a7a38a700f42848877d3719b73452dcb.tar.gz txr-4a5b6f32a7a38a700f42848877d3719b73452dcb.tar.bz2 txr-4a5b6f32a7a38a700f42848877d3719b73452dcb.zip |
ffi: carray-free resets length.
* ffi.c (carray_free): Don't just reset the pointer
to null, but also set the number of elements to zero.
That will prevent indexing operations from dereferencing null.
-rw-r--r-- | ffi.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -2379,6 +2379,7 @@ val carray_free(val carray) if (carray->co.ops == &carray_owned_ops) { free(scry->data); scry->data = 0; + scry->nelem = 0; } else { uw_throwf(error_s, lit("~a: cannot free unowned carray ~s"), self, carray, nao); |