mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
sr: Remove useless code in disk_state_update()
This patch also updates a comment in the same function for accuracy. Found by Coverity issue 1362985. Partily fixes #19567. Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
be78e9ff37
commit
c6de05d529
@ -617,26 +617,24 @@ disk_state_update(void)
|
|||||||
/* Reset current disk state. */
|
/* Reset current disk state. */
|
||||||
disk_state_reset();
|
disk_state_reset();
|
||||||
|
|
||||||
/* First, update elements that we don't need to iterate over a list to
|
/* First, update elements that we don't need to do a construction. */
|
||||||
* construct something. */
|
|
||||||
sr_disk_state->Version = sr_state->version;
|
sr_disk_state->Version = sr_state->version;
|
||||||
sr_disk_state->ValidUntil = sr_state->valid_until;
|
sr_disk_state->ValidUntil = sr_state->valid_until;
|
||||||
sr_disk_state->ValidAfter = sr_state->valid_after;
|
sr_disk_state->ValidAfter = sr_state->valid_after;
|
||||||
|
|
||||||
/* Shared random values. */
|
/* Shared random values. */
|
||||||
next = &sr_disk_state->SharedRandValues;
|
next = &sr_disk_state->SharedRandValues;
|
||||||
*next = NULL;
|
|
||||||
if (sr_state->previous_srv != NULL) {
|
if (sr_state->previous_srv != NULL) {
|
||||||
*next = line = tor_malloc_zero(sizeof(config_line_t));
|
*next = line = tor_malloc_zero(sizeof(config_line_t));
|
||||||
line->key = tor_strdup(dstate_prev_srv_key);
|
line->key = tor_strdup(dstate_prev_srv_key);
|
||||||
disk_state_put_srv_line(sr_state->previous_srv, line);
|
disk_state_put_srv_line(sr_state->previous_srv, line);
|
||||||
|
/* Go to the next shared random value. */
|
||||||
next = &(line->next);
|
next = &(line->next);
|
||||||
}
|
}
|
||||||
if (sr_state->current_srv != NULL) {
|
if (sr_state->current_srv != NULL) {
|
||||||
*next = line = tor_malloc_zero(sizeof(*line));
|
*next = line = tor_malloc_zero(sizeof(*line));
|
||||||
line->key = tor_strdup(dstate_cur_srv_key);
|
line->key = tor_strdup(dstate_cur_srv_key);
|
||||||
disk_state_put_srv_line(sr_state->current_srv, line);
|
disk_state_put_srv_line(sr_state->current_srv, line);
|
||||||
next = &(line->next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the commits and construct config line(s). */
|
/* Parse the commits and construct config line(s). */
|
||||||
|
Loading…
Reference in New Issue
Block a user