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 <[email protected]>
  • Loading branch information
andrey-zelenkov committed Feb 21, 2024
1 parent c104472 commit 2d16d02
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 2d16d02

Please sign in to comment.