summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-04-10 10:58:45 -0700
committerScott Shawcroft <scott@tannewt.org>2019-04-10 10:58:45 -0700
commita152ac1cef31a9b2825e7e02b4d3252f25146451 (patch)
tree8c4e850c90c7f35650cf4dd8646462f094d6df3c /py
parent34c8c669a35657e67602a7e1fc3c1966165284d5 (diff)
parentf115ec219353cb43027548d900be740522035bff (diff)
Merge remote-tracking branch 'adafruit/master' into pybadge_revd
Diffstat (limited to 'py')
-rwxr-xr-xpy/gc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/gc.c b/py/gc.c
index 246df1503..e0439e945 100755
--- a/py/gc.c
+++ b/py/gc.c
@@ -945,6 +945,10 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
#endif // Alternative gc_realloc impl
bool gc_never_free(void *ptr) {
+ // Check to make sure the pointer is on the heap in the first place.
+ if (gc_nbytes(ptr) == 0) {
+ return false;
+ }
// Pointers are stored in a linked list where each block is BYTES_PER_BLOCK long and the first
// pointer is the next block of pointers.
void ** current_reference_block = MP_STATE_MEM(permanent_pointers);