From: James Jones Date: Mon, 31 May 2021 20:19:29 +0000 (-0500) Subject: Check for NULL comparison function for heaps at compile time (#4097) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8941f52f258ea6bc1a145b8a873fe3524ecb78d5;p=thirdparty%2Ffreeradius-server.git Check for NULL comparison function for heaps at compile time (#4097) --- diff --git a/src/lib/util/heap.c b/src/lib/util/heap.c index 7a6c40e4386..b6739546e22 100644 --- a/src/lib/util/heap.c +++ b/src/lib/util/heap.c @@ -64,8 +64,6 @@ fr_heap_t *_fr_heap_alloc(TALLOC_CTX *ctx, fr_heap_cmp_t cmp, char const *type, { fr_heap_t *fh; - if (!cmp) return NULL; - fh = talloc_zero(ctx, fr_heap_t); if (!fh) return NULL; diff --git a/src/lib/util/heap.h b/src/lib/util/heap.h index ccd5a9504e1..c958bdaa019 100644 --- a/src/lib/util/heap.h +++ b/src/lib/util/heap.h @@ -67,7 +67,7 @@ typedef struct fr_heap_s fr_heap_t; #define fr_heap_talloc_alloc(_ctx, _cmp, _talloc_type, _field) \ _fr_heap_alloc(_ctx, _cmp, #_talloc_type, (size_t)offsetof(_talloc_type, _field)) -fr_heap_t *_fr_heap_alloc(TALLOC_CTX *ctx, fr_heap_cmp_t cmp, char const *talloc_type, size_t offset); +fr_heap_t *_fr_heap_alloc(TALLOC_CTX *ctx, fr_heap_cmp_t cmp, char const *talloc_type, size_t offset) CC_HINT(nonnull(2)); /** Check if an entry is inserted into a heap *