Skip to content

Fix buffer leak on contended CONFLATE socket - #4925

Open
rschlaikjer wants to merge 2 commits into
zeromq:masterfrom
rschlaikjer:rs-dbuffer-leak
Open

Fix buffer leak on contended CONFLATE socket#4925
rschlaikjer wants to merge 2 commits into
zeromq:masterfrom
rschlaikjer:rs-dbuffer-leak

Conversation

@rschlaikjer

Copy link
Copy Markdown

Calling write on dbuffer first places the input msg_t in _back, then attempts to swap it with _front.
However, if the swap fails, _back doesn't get reset. If another write then comes in, it overwrites the value in _back without releasing it first.
This can cause memory leaks when CONFLATE is enabled on a contended socket.

Fix this by always closing _back as part of write.

Calling write on dbuffer first places the input msg_t in _back,
then attempts to swap it with _front.
However, if the swap fails, _back doesn't get reset. If another write
then comes in, it overwrites the value in _back without releasing it
first. This can cause memory leaks when CONFLATE is enabled on a
contended socket.
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.

1 participant