fr_heap_t *h = *hp;
fr_heap_index_t child;
+ if (unlikely(h == NULL)) {
+ fr_strerror_const("Heap pointer was NULL");
+ return -1;
+ }
+
child = index_get(h, data);
if (fr_heap_entry_inserted(child)) {
fr_strerror_const("Node is already in the heap");
fr_heap_t *h = *hp;
fr_heap_index_t parent, child, max;
+ if (unlikely(h == NULL)) {
+ fr_strerror_const("Heap pointer was NULL");
+ return -1;
+ }
+
/*
* Extract element.
*/
void *fr_heap_pop(fr_heap_t **hp)
{
fr_heap_t *h = *hp;
-
void *data;
+ if (unlikely(h == NULL)) {
+ fr_strerror_const("Heap pointer was NULL");
+ return -1;
+ }
+
if (h->num_elements == 0) return NULL;
data = h->p[1];