Browse Source

Fix a coupole of coverity complaints.

Nick Mathewson 7 years ago
parent
commit
75a7997148
2 changed files with 4 additions and 6 deletions
  1. 2 4
      src/test/test_circuitlist.c
  2. 2 2
      src/test/test_relay.c

+ 2 - 4
src/test/test_circuitlist.c

@@ -355,10 +355,8 @@ test_pick_circid(void *arg)
   }
 
  done:
-  if (chan1)
-    circuitmux_free(chan1->cmux);
-  if (chan2)
-    circuitmux_free(chan2->cmux);
+  circuitmux_free(chan1->cmux);
+  circuitmux_free(chan2->cmux);
   tor_free(chan1);
   tor_free(chan2);
   bitarray_free(ba);

+ 2 - 2
src/test/test_relay.c

@@ -113,11 +113,11 @@ test_relay_append_cell_to_circuit_queue(void *arg)
 
  done:
   tor_free(cell);
-  cell_queue_clear(&orcirc->base_.n_chan_cells);
-  cell_queue_clear(&orcirc->p_chan_cells);
   if (orcirc) {
     circuitmux_detach_circuit(nchan->cmux, TO_CIRCUIT(orcirc));
     circuitmux_detach_circuit(pchan->cmux, TO_CIRCUIT(orcirc));
+    cell_queue_clear(&orcirc->base_.n_chan_cells);
+    cell_queue_clear(&orcirc->p_chan_cells);
   }
   tor_free(orcirc);
   free_fake_channel(nchan);