Skip to content

Commit

Permalink
Initialize port_impl only when it is needed
Browse files Browse the repository at this point in the history
Found by UndefinedBehaviorSanitizer.

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
  • Loading branch information
andrey-zelenkov committed Feb 22, 2024
1 parent 213864c commit e6571b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nxt_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,9 +1483,9 @@ nxt_unit_request_check_response_port(nxt_unit_request_info_t *req,
pthread_mutex_lock(&lib->mutex);

port = nxt_unit_port_hash_find(&lib->ports, port_id, 0);
port_impl = nxt_container_of(port, nxt_unit_port_impl_t, port);

if (nxt_fast_path(port != NULL)) {
port_impl = nxt_container_of(port, nxt_unit_port_impl_t, port);
req->response_port = port;

if (nxt_fast_path(port_impl->ready)) {
Expand Down

0 comments on commit e6571b8

Please sign in to comment.