about summary refs log tree commit
path: root/ext/rpatricia/rpatricia.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/rpatricia/rpatricia.c')
-rw-r--r--ext/rpatricia/rpatricia.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/rpatricia/rpatricia.c b/ext/rpatricia/rpatricia.c
index f9564d2..866572c 100644
--- a/ext/rpatricia/rpatricia.c
+++ b/ext/rpatricia/rpatricia.c
@@ -12,13 +12,15 @@ static VALUE cPatricia, cNode;
 
 static void dummy(void) {}
 
-/*
- * this method only exists for backwards compatibility, we now rely
- * on the GC to do all the dirty work of freeing node data for us
- */
 static VALUE
 p_destroy (VALUE self)
 {
+  patricia_tree_t *tree;
+
+  Data_Get_Struct(self, patricia_tree_t, tree);
+  Clear_Patricia(tree, dummy);
+  tree->head = NULL; /* Clear_Patricia() should do this, actually */
+
   return Qtrue;
 }