]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Sprinkle more unlikelys
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 17 Aug 2021 19:10:46 +0000 (14:10 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 17 Aug 2021 19:10:46 +0000 (14:10 -0500)
src/lib/util/heap.c

index 6430a67bd89f7674956906e2f9b9d29eea7f07d9..39adf7c5c0b90d1ce7be6c5c0d6babd057beb3c5 100644 (file)
@@ -69,7 +69,7 @@ fr_heap_t *_fr_heap_alloc(TALLOC_CTX *ctx, fr_heap_cmp_t cmp, char const *type,
 
        hp->size = 2048;
        hp->p = talloc_array(hp, void *, hp->size);
-       if (!hp->p) {
+       if (unlikely(!hp->p)) {
                talloc_free(hp);
                return NULL;
        }
@@ -162,7 +162,7 @@ int fr_heap_insert(fr_heap_t *hp, void *data)
                }
 
                n = talloc_realloc(hp, hp->p, void *, n_size);
-               if (!n) {
+               if (unlikely(!n)) {
                        fr_strerror_printf("Failed expanding heap to %u elements (%u bytes)",
                                           n_size, (n_size * (unsigned int)sizeof(void *)));
                        return -1;