ref: 5b99cfc34279cd95c82510c4404b6625170dbdfb
parent: e92d26d0e1e1e52f4f9a8f81865e56f7aad5ff57
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Mar 1 12:07:57 EST 2021
rb trees: break out of the loop when parent is NULL
--- a/include/misc/tree.h
+++ b/include/misc/tree.h
@@ -484,7 +484,7 @@
{ \
struct type *tmp; \
while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \
- elm != RB_ROOT(head)) { \
+ elm != RB_ROOT(head) && parent != NULL) { \
if (RB_LEFT(parent, field) == elm) { \
tmp = RB_RIGHT(parent, field); \
if (RB_COLOR(tmp, field) == RB_RED) { \