mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
scan-build: when logging a path length, check build_state.
Throughout circuituse, when we log about a circuit, we log its desired path length from build_state. scan-build is irrationally concerned that build_state might be NULL.
This commit is contained in:
parent
7106492571
commit
7cd9520ba9
@ -537,7 +537,9 @@ circuit_expire_building(void)
|
|||||||
"%d guards are live.",
|
"%d guards are live.",
|
||||||
TO_ORIGIN_CIRCUIT(victim)->global_identifier,
|
TO_ORIGIN_CIRCUIT(victim)->global_identifier,
|
||||||
circuit_purpose_to_string(victim->purpose),
|
circuit_purpose_to_string(victim->purpose),
|
||||||
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len,
|
TO_ORIGIN_CIRCUIT(victim)->build_state ?
|
||||||
|
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len :
|
||||||
|
-1,
|
||||||
circuit_state_to_string(victim->state),
|
circuit_state_to_string(victim->state),
|
||||||
channel_state_to_string(victim->n_chan->state),
|
channel_state_to_string(victim->n_chan->state),
|
||||||
num_live_entry_guards(0));
|
num_live_entry_guards(0));
|
||||||
@ -561,7 +563,9 @@ circuit_expire_building(void)
|
|||||||
"anyway. %d guards are live.",
|
"anyway. %d guards are live.",
|
||||||
TO_ORIGIN_CIRCUIT(victim)->global_identifier,
|
TO_ORIGIN_CIRCUIT(victim)->global_identifier,
|
||||||
circuit_purpose_to_string(victim->purpose),
|
circuit_purpose_to_string(victim->purpose),
|
||||||
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len,
|
TO_ORIGIN_CIRCUIT(victim)->build_state ?
|
||||||
|
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len :
|
||||||
|
-1,
|
||||||
circuit_state_to_string(victim->state),
|
circuit_state_to_string(victim->state),
|
||||||
channel_state_to_string(victim->n_chan->state),
|
channel_state_to_string(victim->n_chan->state),
|
||||||
(long)build_close_ms,
|
(long)build_close_ms,
|
||||||
@ -707,7 +711,8 @@ circuit_expire_building(void)
|
|||||||
* and we have tried to send an INTRODUCE1 cell specifying it.
|
* and we have tried to send an INTRODUCE1 cell specifying it.
|
||||||
* Thus, if the pending_final_cpath field *is* NULL, then we
|
* Thus, if the pending_final_cpath field *is* NULL, then we
|
||||||
* want to not spare it. */
|
* want to not spare it. */
|
||||||
if (TO_ORIGIN_CIRCUIT(victim)->build_state->pending_final_cpath ==
|
if (TO_ORIGIN_CIRCUIT(victim)->build_state &&
|
||||||
|
TO_ORIGIN_CIRCUIT(victim)->build_state->pending_final_cpath ==
|
||||||
NULL)
|
NULL)
|
||||||
break;
|
break;
|
||||||
/* fallthrough! */
|
/* fallthrough! */
|
||||||
@ -753,7 +758,9 @@ circuit_expire_building(void)
|
|||||||
TO_ORIGIN_CIRCUIT(victim)->has_opened,
|
TO_ORIGIN_CIRCUIT(victim)->has_opened,
|
||||||
victim->state, circuit_state_to_string(victim->state),
|
victim->state, circuit_state_to_string(victim->state),
|
||||||
victim->purpose,
|
victim->purpose,
|
||||||
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len);
|
TO_ORIGIN_CIRCUIT(victim)->build_state ?
|
||||||
|
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len :
|
||||||
|
-1);
|
||||||
else
|
else
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Abandoning circ %u %u (state %d,%d:%s, purpose %d, len %d)",
|
"Abandoning circ %u %u (state %d,%d:%s, purpose %d, len %d)",
|
||||||
@ -762,7 +769,9 @@ circuit_expire_building(void)
|
|||||||
TO_ORIGIN_CIRCUIT(victim)->has_opened,
|
TO_ORIGIN_CIRCUIT(victim)->has_opened,
|
||||||
victim->state,
|
victim->state,
|
||||||
circuit_state_to_string(victim->state), victim->purpose,
|
circuit_state_to_string(victim->state), victim->purpose,
|
||||||
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len);
|
TO_ORIGIN_CIRCUIT(victim)->build_state ?
|
||||||
|
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len :
|
||||||
|
-1);
|
||||||
|
|
||||||
circuit_log_path(LOG_INFO,LD_CIRC,TO_ORIGIN_CIRCUIT(victim));
|
circuit_log_path(LOG_INFO,LD_CIRC,TO_ORIGIN_CIRCUIT(victim));
|
||||||
if (victim->purpose == CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT)
|
if (victim->purpose == CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT)
|
||||||
|
Loading…
Reference in New Issue
Block a user