Initializing local buffer ctx_impl field for correct release.

Uninitialized ctx_impl field may cause crash in application process.

To reproduce the issue, need to trigger shared memory buffer send error on
application side.  In our case, send error caused by router process crash.

This issue was introduced in 2c7f79bf0a1f.
This commit is contained in:
Max Romanov
2020-02-03 11:21:21 +03:00
parent 7ea9ebc55a
commit 8eba2e5c3d

View File

@@ -3207,6 +3207,7 @@ nxt_unit_get_outgoing_buf(nxt_unit_ctx_t *ctx, nxt_unit_process_t *process,
mmap_buf->port_id = *port_id;
mmap_buf->process = process;
mmap_buf->free_ptr = NULL;
mmap_buf->ctx_impl = nxt_container_of(ctx, nxt_unit_ctx_impl_t, ctx);
nxt_unit_debug(ctx, "outgoing mmap allocation: (%d,%d,%d)",
(int) hdr->id, (int) c,