summaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-07-29 22:36:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-07-29 22:36:19 -0700
commitb6955812c33d432557b93fe4638b411ff944334b (patch)
treed48b5668cbb7159ec8661aa2b179d42f34aa203a /gc.c
parentc439d4bb117ebcc59bd34711326ebb5090b2da2a (diff)
downloadtxr-b6955812c33d432557b93fe4638b411ff944334b.tar.gz
txr-b6955812c33d432557b93fe4638b411ff944334b.tar.bz2
txr-b6955812c33d432557b93fe4638b411ff944334b.zip
* gc.c (finalize): Null out cobj handle after calling the
destructor. This can catch some use-after-free errors.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 4965066a..8a870cb2 100644
--- a/gc.c
+++ b/gc.c
@@ -254,6 +254,7 @@ static void finalize(val obj)
return;
case COBJ:
obj->co.ops->destroy(obj);
+ obj->co.handle = 0;
return;
case BGNUM:
mp_clear(mp(obj));