diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2019-02-21 16:30:59 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2019-02-21 16:30:59 +0300 |
commit | 3280b826e373bf88c16640cb434771df378bbb07 (patch) | |
tree | 2a229409b03800ad456931296e22d6d6e9b489f4 /src/nxt_unit.c | |
parent | 499096a55a681609a9b655059e2f56638bcf104e (diff) | |
download | unit-3280b826e373bf88c16640cb434771df378bbb07.tar.gz unit-3280b826e373bf88c16640cb434771df378bbb07.tar.bz2 |
Initializing incoming buffer queue in a proper place.
In case nxt_unit_tracking_read() failed, execution would jump to the error path,
where it could try to release buffers from uninitialized yet incoming_buf queue.
Diffstat (limited to 'src/nxt_unit.c')
-rw-r--r-- | src/nxt_unit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nxt_unit.c b/src/nxt_unit.c index 24e51075..fa1fb1d5 100644 --- a/src/nxt_unit.c +++ b/src/nxt_unit.c @@ -541,6 +541,8 @@ nxt_unit_process_msg(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id, memcpy(&fd, CMSG_DATA(cm), sizeof(int)); } + nxt_queue_init(&incoming_buf); + if (nxt_slow_path(buf_size < sizeof(nxt_port_msg_t))) { nxt_unit_warn(ctx, "message too small (%d bytes)", (int) buf_size); goto fail; @@ -570,8 +572,6 @@ nxt_unit_process_msg(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id, } if (port_msg->mmap) { - nxt_queue_init(&incoming_buf); - if (nxt_unit_mmap_read(ctx, &recv_msg, &incoming_buf) != NXT_UNIT_OK) { goto fail; } |