Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
George Kadianakis
Tor
Commits
9b464cdc
Commit
9b464cdc
authored
Jul 09, 2021
by
George Kadianakis
Browse files
Add layer2_guard_free()
parent
a77727cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/feature/client/entrynodes.c
View file @
9b464cdc
...
...
@@ -3944,6 +3944,19 @@ typedef struct layer2_guard_t {
time_t
expire_on_date
;
}
layer2_guard_t
;
#define layer2_guard_free(val) \
FREE_AND_NULL(layer2_guard_t, layer2_guard_free_, (val))
static
void
layer2_guard_free_
(
layer2_guard_t
*
l2
)
{
if
(
!
l2
)
{
return
;
}
tor_free
(
l2
);
}
/** Global list and routerset of L2 guards. They are both synced and they get
* updated periodically. We need both the list and the routerset: we use the
* smartlist to keep track of expiration times and the routerset is what we
...
...
@@ -4029,7 +4042,7 @@ maintain_layer2_guards(void)
safe_str_client
(
hex_str
(
g
->
identity
,
DIGEST_LEN
)));
// Nickname may be gone from consensus and doesn't matter anyway
control_event_guard
(
"None"
,
g
->
identity
,
"BAD_L2"
);
tor
_free
(
g
);
layer2_guard
_free
(
g
);
SMARTLIST_DEL_CURRENT_KEEPORDER
(
layer2_guards
,
g
);
continue
;
}
...
...
@@ -4040,7 +4053,7 @@ maintain_layer2_guards(void)
safe_str_client
(
hex_str
(
g
->
identity
,
DIGEST_LEN
)));
// Nickname may be gone from consensus and doesn't matter anyway
control_event_guard
(
"None"
,
g
->
identity
,
"BAD_L2"
);
tor
_free
(
g
);
layer2_guard
_free
(
g
);
SMARTLIST_DEL_CURRENT_KEEPORDER
(
layer2_guards
,
g
);
continue
;
}
...
...
@@ -4110,7 +4123,7 @@ purge_vanguards_lite(void)
/* Go through the list and perform any needed expirations */
SMARTLIST_FOREACH_BEGIN
(
layer2_guards
,
layer2_guard_t
*
,
g
)
{
tor
_free
(
g
);
layer2_guard
_free
(
g
);
}
SMARTLIST_FOREACH_END
(
g
);
smartlist_clear
(
layer2_guards
);
...
...
@@ -4158,7 +4171,7 @@ entry_guards_free_all(void)
}
SMARTLIST_FOREACH_BEGIN
(
layer2_guards
,
layer2_guard_t
*
,
g
)
{
tor
_free
(
g
);
layer2_guard
_free
(
g
);
}
SMARTLIST_FOREACH_END
(
g
);
smartlist_free
(
layer2_guards
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment