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 | 9bb817c2beac1baf40a9d022db350fc83a453da2 (patch) | |
tree | 13b708a26dfd586dfcf580c6f5d7a941a0a03742 | |
parent | 5b3e080091e1bf9bca2fd6e3995da6424a350f62 (diff) | |
download | txr-9bb817c2beac1baf40a9d022db350fc83a453da2.tar.gz txr-9bb817c2beac1baf40a9d022db350fc83a453da2.tar.bz2 txr-9bb817c2beac1baf40a9d022db350fc83a453da2.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); |