[nanomsg] [PATCH] Fix use-after-free when astream fail to initialize

  • From: Nir Soffer <nirsof@xxxxxxxxx>
  • To: nanosmg list <nanomsg@xxxxxxxxxxxxx>
  • Date: Mon, 11 Mar 2013 07:24:26 +0200

When nn_astream_init fails, bstream was adding an invalid object to the
astreams list. This leads to "impossible" failures later.

This patch add the astream to the bstream->astreams list inside
nn_astream_init, before calling nn_stream_init. If nn_stream_init fails
when the astream is included in the astreams list, it is removed
properly.

This change fixes the random crashes in the tcp_shutdown test. The test
runs now 200 time in a loop without an error.

License: MIT

Attachment: 0001-Fix-use-after-free-when-astream-fail-to-initialize.patch
Description: Binary data

Other related posts: