]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check for NULL comparison function for heaps at compile time (#4097)
authorJames Jones <jejones3141@gmail.com>
Mon, 31 May 2021 20:19:29 +0000 (15:19 -0500)
committerGitHub <noreply@github.com>
Mon, 31 May 2021 20:19:29 +0000 (16:19 -0400)
src/lib/util/heap.c
src/lib/util/heap.h

index 7a6c40e43862ba03ffd5716ec8d18f33316dc3ca..b6739546e22bb2fcb8908a430fa785210abd357f 100644 (file)
@@ -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;
 
index ccd5a9504e104472fddfa72c39b87a2cc7812e3f..c958bdaa019ac69547ef1e9fecf9b5d273d7cf4e 100644 (file)
@@ -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
  *