diff options
Diffstat (limited to 'src/test/test_scheduler.c')
-rw-r--r-- | src/test/test_scheduler.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/test_scheduler.c b/src/test/test_scheduler.c index 15fbb2d186..f8b5046c70 100644 --- a/src/test/test_scheduler.c +++ b/src/test/test_scheduler.c @@ -150,7 +150,7 @@ channel_flush_some_cells_mock_free_all(void) static void channel_flush_some_cells_mock_set(channel_t *chan, ssize_t num_cells) { - flush_mock_channel_t *flush_mock_ch = NULL; + int found = 0; if (!chan) return; if (num_cells <= 0) return; @@ -166,6 +166,7 @@ channel_flush_some_cells_mock_set(channel_t *chan, ssize_t num_cells) if (flush_mock_ch->chan == chan) { /* Found it */ flush_mock_ch->cells = num_cells; + found = 1; break; } } else { @@ -175,8 +176,9 @@ channel_flush_some_cells_mock_set(channel_t *chan, ssize_t num_cells) } } SMARTLIST_FOREACH_END(flush_mock_ch); - if (!flush_mock_ch) { + if (! found) { /* The loop didn't find it */ + flush_mock_channel_t *flush_mock_ch; flush_mock_ch = tor_malloc_zero(sizeof(*flush_mock_ch)); flush_mock_ch->chan = chan; flush_mock_ch->cells = num_cells; |