aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-06-29 19:38:14 +0300
committerDavid Goulet <dgoulet@torproject.org>2019-07-25 10:24:19 -0400
commitbd1ac408d854758cc40bde88cc5f71b46661b51c (patch)
tree25f3d312aed5716f0a50be8e7dba29e450cfe8a1
parent2a4b156978c8f25c6c5850a393f27fcbfba5466a (diff)
downloadtor-bd1ac408d854758cc40bde88cc5f71b46661b51c.tar.gz
tor-bd1ac408d854758cc40bde88cc5f71b46661b51c.zip
Remove dead code from circpad_machine_remove_token().
-rw-r--r--changes/bug310273
-rw-r--r--src/core/or/circuitpadding.c9
2 files changed, 7 insertions, 5 deletions
diff --git a/changes/bug31027 b/changes/bug31027
new file mode 100644
index 0000000000..dd3ce20b60
--- /dev/null
+++ b/changes/bug31027
@@ -0,0 +1,3 @@
+ o Code simplification and refactoring:
+ - Remove some dead code from circpad_machine_remove_token() to fix some
+ Coverity warnings (CID 1447298). Fixes bug 31027; bugfix on 0.4.1.1-alpha. \ No newline at end of file
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index 0214cc4219..626787da7b 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -1083,8 +1083,11 @@ circpad_machine_remove_token(circpad_machine_runtime_t *mi)
state = circpad_machine_current_state(mi);
+ /* If we are not in a padding state (like start or end), we're done */
+ if (!state)
+ return;
/* Don't remove any tokens if we're not doing token removal */
- if (!state || state->token_removal == CIRCPAD_TOKEN_REMOVAL_NONE)
+ if (state->token_removal == CIRCPAD_TOKEN_REMOVAL_NONE)
return;
current_time = monotime_absolute_usec();
@@ -1103,10 +1106,6 @@ circpad_machine_remove_token(circpad_machine_runtime_t *mi)
timer_disable(mi->padding_timer);
}
- /* If we are not in a padding state (like start or end), we're done */
- if (!state)
- return;
-
/* Perform the specified token removal strategy */
switch (state->token_removal) {
case CIRCPAD_TOKEN_REMOVAL_CLOSEST_USEC: