59498e3256
When ndb_filter_end processes an empty filter (no fields added), it calls realloc(filter->elem_buf.start, 0) which frees the memory and returns NULL. The existing code only updated the pointer if realloc returned non-NULL, leaving elem_buf.start pointing to freed memory. This caused a double-free crash when ndb_filter_destroy later called free() on the dangling pointer. Fix by explicitly setting filter->elem_buf.start to NULL when realloc returns NULL due to zero-size allocation, and update the assertion to allow NULL pointers for empty filters. ndb_filter_destroy already checks for NULL before freeing. Closes: https://github.com/damus-io/damus/issues/3634 Changelog-Fixed: Fix memory corruption crash when creating empty filters Signed-off-by: Daniel D’Aquino <daniel@daquino.me>