Skip to content

Fix double free in pipe_t::process_pipe_term_ack#4853

Open
ssam18 wants to merge 1 commit intozeromq:masterfrom
ssam18:fix/pipe-term-ack-double-free
Open

Fix double free in pipe_t::process_pipe_term_ack#4853
ssam18 wants to merge 1 commit intozeromq:masterfrom
ssam18:fix/pipe-term-ack-double-free

Conversation

@ssam18
Copy link
Copy Markdown

@ssam18 ssam18 commented Apr 17, 2026

The _in_pipe pointer was being used to drain messages and then deleted via LIBZMQ_DELETE, but the command dispatch loop in io_thread_t::in_event processes all mailbox commands in a single pass. If a second command arrives for the same pipe_t after delete this is executed, the object's memory has already been freed and _in_pipe becomes a dangling pointer, leading to a double free.

This fix saves _in_pipe to a local and nulls out the member before draining, so any stale access to the deleted object sees NULL rather than a freed ypipe pointer. Fixes #4806.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Double free happening in ZMQ 4.3.4 version, causing reaper and IO thread crashes when system goes down

1 participant