diff options
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/tdelete.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdlib/tdelete.c b/lib/libc/stdlib/tdelete.c index c83afb8..a27802e 100644 --- a/lib/libc/stdlib/tdelete.c +++ b/lib/libc/stdlib/tdelete.c @@ -65,7 +65,8 @@ tdelete(const void * __restrict vkey, void ** __restrict vrootp, q->rlink = (*rootp)->rlink; } } - free(*rootp); /* D4: Free node */ + if (p != *rootp) + free(*rootp); /* D4: Free node */ *rootp = q; /* link parent to new node */ return p; } |