diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/conts/sptree.h | 10 | 
1 files changed, 8 insertions, 2 deletions
diff --git a/include/conts/sptree.h b/include/conts/sptree.h index 75b88fc..e305c0f 100644 --- a/include/conts/sptree.h +++ b/include/conts/sptree.h @@ -400,12 +400,18 @@ static inline void SPTREE(remove)(struct SPROOT *s, SPTREE_TYPE data)  		return;  	SPTREE(remove_found)(s, found); +	struct SPNODE *del = CONTAINER_OF(found, struct SPNODE, data); +	free(del);  }  static inline void SPTREE(destroy)(struct SPROOT *s)  { -	while (s->root) -		SPTREE(remove_found)(s, &s->root->data); +	while (s->root) { +		SPTREE_TYPE *top = &s->root->data; +		SPTREE(remove_found)(s, top); +		struct SPNODE *del = CONTAINER_OF(top, struct SPNODE, data); +		free(del); +	}  }  #undef SPTREE  | 
