Commit f5059c26 authored by brendan's avatar brendan

rwlocks were not getting destroyed when avl nodes or trees were freed.

avl.h already includes thread.h

svn path=/trunk/avl/; revision=4410
parent ea307d20
......@@ -22,7 +22,7 @@
*
*/
/* $Id: avl.c,v 1.1 2001/09/10 02:28:03 jack Exp $ */
/* $Id: avl.c,v 1.2 2003/03/06 00:59:41 brendan Exp $ */
/*
* This is a fairly straightfoward translation of a prototype
......@@ -32,10 +32,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "thread.h"
#include "avl.h"
avl_node *
avl_node_new (void * key,
avl_node * parent)
......@@ -103,6 +101,7 @@ avl_tree_free (avl_tree * tree, avl_free_key_fun_type free_key_fun)
if (tree->root) {
free (tree->root);
}
thread_rwlock_destroy(&tree->rwlock);
free (tree);
}
......@@ -442,6 +441,7 @@ int avl_delete(avl_tree *tree, void *key, avl_free_key_fun_type free_key_fun)
/* return the key and node to storage */
free_key_fun (x->key);
thread_rwlock_destroy (&x->rwlock);
free (x);
while (shorter && p->parent) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment