[vlc-devel] [PATCH v3] compat: update tdelete from upstream NetBSD
Steve Lhomme
robux4 at ycbcr.xyz
Fri Apr 2 13:29:27 UTC 2021
As found in http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdlib/tdelete.c?rev=1.8&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
Or https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/tdelete.c
Our tfind, tsearch and twalk are already similar to upstream. For some reason,
tdestroy is not there as a single file anymore.
Fixes some leaks solved on 2016-01-20.
---
compat/tfind.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/compat/tfind.c b/compat/tfind.c
index 03382f2aea5..698190ae9bd 100644
--- a/compat/tfind.c
+++ b/compat/tfind.c
@@ -17,7 +17,7 @@ typedef struct node {
struct node *llink, *rlink;
} node_t;
-/* $NetBSD: tdelete.c,v 1.4 2006/03/19 01:12:08 christos Exp $ */
+/* $NetBSD: tdelete.c,v 1.8 2016/01/20 20:47:41 christos Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
@@ -67,8 +67,7 @@ tdelete(const void* vkey, void** vrootp, int (*compar)(const void*, const void*)
q->rlink = (*rootp)->rlink;
}
}
- if (p != *rootp)
- free(*rootp); /* D4: Free node */
+ free(*rootp); /* D4: Free node */
*rootp = q; /* link parent to new node */
return p;
}
--
2.29.2
More information about the vlc-devel
mailing list