Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ext/spl/spl_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static zend_always_inline void *spl_heap_elem(spl_ptr_heap *heap, size_t i) {
}

static zend_always_inline void spl_heap_elem_copy(spl_ptr_heap *heap, void *to, void *from) {
assert(to != from);
memcpy(to, from, heap->elem_size);
}

Expand Down Expand Up @@ -325,7 +326,10 @@ static int spl_ptr_heap_delete_top(spl_ptr_heap *heap, void *elem, void *cmp_use
heap->flags |= SPL_HEAP_CORRUPTED;
}

spl_heap_elem_copy(heap, spl_heap_elem(heap, i), bottom);
void *to = spl_heap_elem(heap, i);
if (to != bottom) {
spl_heap_elem_copy(heap, to, bottom);
}
return SUCCESS;
}
/* }}} */
Expand Down