Skip to content

Fix double free in pipe_t::process_pipe_term_ack - #4853

Merged
bluca merged 1 commit into
zeromq:masterfrom
ssam18:fix/pipe-term-ack-double-free
Jul 2, 2026
Merged

Fix double free in pipe_t::process_pipe_term_ack#4853
bluca merged 1 commit into
zeromq:masterfrom
ssam18:fix/pipe-term-ack-double-free

Conversation

@ssam18

@ssam18 ssam18 commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

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.

Comment thread src/pipe.cpp Outdated
@bluca
bluca force-pushed the fix/pipe-term-ack-double-free branch from 412790c to 09c9dd0 Compare July 2, 2026 19:04
@bluca
bluca force-pushed the fix/pipe-term-ack-double-free branch from 09c9dd0 to 5993468 Compare July 2, 2026 19:07
@bluca
bluca merged commit acef50b into zeromq:master Jul 2, 2026
21 of 22 checks passed
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

2 participants