diff --git a/src/libsysprof-analyze/sysprof-symbol-cache.c b/src/libsysprof-analyze/sysprof-symbol-cache.c index 3a8c5792..b657a380 100644 --- a/src/libsysprof-analyze/sysprof-symbol-cache.c +++ b/src/libsysprof-analyze/sysprof-symbol-cache.c @@ -178,6 +178,13 @@ sysprof_symbol_cache_lookup (SysprofSymbolCache *self, node = RB_ROOT(&self->head); + /* The root node contains our calculated max as augmented in RBTree. + * Therefore, we can know if @address falls beyond the upper bound + * in O(1) without having to add a branch to the while loop below. + */ + if (node == NULL || node->max < address) + return NULL; + while (node != NULL) { g_assert (RB_LEFT(node, link) == NULL ||