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
David Goulet
Tor
Commits
0c1b3070
Commit
0c1b3070
authored
Dec 12, 2009
by
Nick Mathewson
🥄
Browse files
Now that FOO_free(NULL) always works, remove checks before calling it.
parent
79f72d0e
Changes
24
Hide whitespace changes
Inline
Side-by-side
src/common/torgzip.c
View file @
0c1b3070
...
@@ -165,9 +165,7 @@ tor_gzip_compress(char **out, size_t *out_len,
...
@@ -165,9 +165,7 @@ tor_gzip_compress(char **out, size_t *out_len,
deflateEnd
(
stream
);
deflateEnd
(
stream
);
tor_free
(
stream
);
tor_free
(
stream
);
}
}
if
(
*
out
)
{
tor_free
(
*
out
);
tor_free
(
*
out
);
}
return
-
1
;
return
-
1
;
}
}
...
...
src/common/tortls.c
View file @
0c1b3070
...
@@ -1314,10 +1314,8 @@ log_cert_lifetime(X509 *cert, const char *problem)
...
@@ -1314,10 +1314,8 @@ log_cert_lifetime(X509 *cert, const char *problem)
tls_log_errors
(
NULL
,
LOG_WARN
,
LD_NET
,
"getting certificate lifetime"
);
tls_log_errors
(
NULL
,
LOG_WARN
,
LD_NET
,
"getting certificate lifetime"
);
if
(
bio
)
if
(
bio
)
BIO_free
(
bio
);
BIO_free
(
bio
);
if
(
s1
)
tor_free
(
s1
);
tor_free
(
s1
);
tor_free
(
s2
);
if
(
s2
)
tor_free
(
s2
);
}
}
/** Helper function: try to extract a link certificate and an identity
/** Helper function: try to extract a link certificate and an identity
...
...
src/common/util.c
View file @
0c1b3070
...
@@ -953,8 +953,7 @@ const char *
...
@@ -953,8 +953,7 @@ const char *
escaped
(
const
char
*
s
)
escaped
(
const
char
*
s
)
{
{
static
char
*
_escaped_val
=
NULL
;
static
char
*
_escaped_val
=
NULL
;
if
(
_escaped_val
)
tor_free
(
_escaped_val
);
tor_free
(
_escaped_val
);
if
(
s
)
if
(
s
)
_escaped_val
=
esc_for_log
(
s
);
_escaped_val
=
esc_for_log
(
s
);
...
...
src/or/circuitbuild.c
View file @
0c1b3070
...
@@ -364,7 +364,7 @@ circuit_build_times_update_state(circuit_build_times_t *cbt,
...
@@ -364,7 +364,7 @@ circuit_build_times_update_state(circuit_build_times_t *cbt,
or_state_mark_dirty
(
get_or_state
(),
0
);
or_state_mark_dirty
(
get_or_state
(),
0
);
}
}
if
(
histogram
)
tor_free
(
histogram
);
tor_free
(
histogram
);
}
}
/**
/**
...
@@ -1819,10 +1819,9 @@ circuit_finish_handshake(origin_circuit_t *circ, uint8_t reply_type,
...
@@ -1819,10 +1819,9 @@ circuit_finish_handshake(origin_circuit_t *circ, uint8_t reply_type,
return
-
END_CIRC_REASON_TORPROTOCOL
;
return
-
END_CIRC_REASON_TORPROTOCOL
;
}
}
if
(
hop
->
dh_handshake_state
)
{
crypto_dh_free
(
hop
->
dh_handshake_state
);
/* don't need it anymore */
crypto_dh_free
(
hop
->
dh_handshake_state
);
/* don't need it anymore */
hop
->
dh_handshake_state
=
NULL
;
hop
->
dh_handshake_state
=
NULL
;
}
memset
(
hop
->
fast_handshake_state
,
0
,
sizeof
(
hop
->
fast_handshake_state
));
memset
(
hop
->
fast_handshake_state
,
0
,
sizeof
(
hop
->
fast_handshake_state
));
if
(
circuit_init_cpath_crypto
(
hop
,
keys
,
0
)
<
0
)
{
if
(
circuit_init_cpath_crypto
(
hop
,
keys
,
0
)
<
0
)
{
...
@@ -2430,8 +2429,7 @@ circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *exit)
...
@@ -2430,8 +2429,7 @@ circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *exit)
state
=
circ
->
build_state
;
state
=
circ
->
build_state
;
tor_assert
(
state
);
tor_assert
(
state
);
if
(
state
->
chosen_exit
)
extend_info_free
(
state
->
chosen_exit
);
extend_info_free
(
state
->
chosen_exit
);
state
->
chosen_exit
=
extend_info_dup
(
exit
);
state
->
chosen_exit
=
extend_info_dup
(
exit
);
++
circ
->
build_state
->
desired_path_len
;
++
circ
->
build_state
->
desired_path_len
;
...
@@ -2746,8 +2744,7 @@ extend_info_free(extend_info_t *info)
...
@@ -2746,8 +2744,7 @@ extend_info_free(extend_info_t *info)
{
{
if
(
!
info
)
if
(
!
info
)
return
;
return
;
if
(
info
->
onion_key
)
crypto_free_pk_env
(
info
->
onion_key
);
crypto_free_pk_env
(
info
->
onion_key
);
tor_free
(
info
);
tor_free
(
info
);
}
}
...
...
src/or/circuitlist.c
View file @
0c1b3070
...
@@ -451,18 +451,15 @@ circuit_free(circuit_t *circ)
...
@@ -451,18 +451,15 @@ circuit_free(circuit_t *circ)
memlen
=
sizeof
(
origin_circuit_t
);
memlen
=
sizeof
(
origin_circuit_t
);
tor_assert
(
circ
->
magic
==
ORIGIN_CIRCUIT_MAGIC
);
tor_assert
(
circ
->
magic
==
ORIGIN_CIRCUIT_MAGIC
);
if
(
ocirc
->
build_state
)
{
if
(
ocirc
->
build_state
)
{
if
(
ocirc
->
build_state
->
chosen_exit
)
extend_info_free
(
ocirc
->
build_state
->
chosen_exit
);
extend_info_free
(
ocirc
->
build_state
->
chosen_exit
);
if
(
ocirc
->
build_state
->
pending_final_cpath
)
circuit_free_cpath_node
(
ocirc
->
build_state
->
pending_final_cpath
);
circuit_free_cpath_node
(
ocirc
->
build_state
->
pending_final_cpath
);
}
}
tor_free
(
ocirc
->
build_state
);
tor_free
(
ocirc
->
build_state
);
circuit_free_cpath
(
ocirc
->
cpath
);
circuit_free_cpath
(
ocirc
->
cpath
);
if
(
ocirc
->
intro_key
)
crypto_free_pk_env
(
ocirc
->
intro_key
);
crypto_free_pk_env
(
ocirc
->
intro_key
);
if
(
ocirc
->
rend_data
)
rend_data_free
(
ocirc
->
rend_data
);
rend_data_free
(
ocirc
->
rend_data
);
}
else
{
}
else
{
or_circuit_t
*
ocirc
=
TO_OR_CIRCUIT
(
circ
);
or_circuit_t
*
ocirc
=
TO_OR_CIRCUIT
(
circ
);
/* Remember cell statistics for this circuit before deallocating. */
/* Remember cell statistics for this circuit before deallocating. */
...
@@ -472,14 +469,10 @@ circuit_free(circuit_t *circ)
...
@@ -472,14 +469,10 @@ circuit_free(circuit_t *circ)
memlen
=
sizeof
(
or_circuit_t
);
memlen
=
sizeof
(
or_circuit_t
);
tor_assert
(
circ
->
magic
==
OR_CIRCUIT_MAGIC
);
tor_assert
(
circ
->
magic
==
OR_CIRCUIT_MAGIC
);
if
(
ocirc
->
p_crypto
)
crypto_free_cipher_env
(
ocirc
->
p_crypto
);
crypto_free_cipher_env
(
ocirc
->
p_crypto
);
crypto_free_digest_env
(
ocirc
->
p_digest
);
if
(
ocirc
->
p_digest
)
crypto_free_cipher_env
(
ocirc
->
n_crypto
);
crypto_free_digest_env
(
ocirc
->
p_digest
);
crypto_free_digest_env
(
ocirc
->
n_digest
);
if
(
ocirc
->
n_crypto
)
crypto_free_cipher_env
(
ocirc
->
n_crypto
);
if
(
ocirc
->
n_digest
)
crypto_free_digest_env
(
ocirc
->
n_digest
);
if
(
ocirc
->
rend_splice
)
{
if
(
ocirc
->
rend_splice
)
{
or_circuit_t
*
other
=
ocirc
->
rend_splice
;
or_circuit_t
*
other
=
ocirc
->
rend_splice
;
...
@@ -495,8 +488,7 @@ circuit_free(circuit_t *circ)
...
@@ -495,8 +488,7 @@ circuit_free(circuit_t *circ)
cell_queue_clear
(
&
ocirc
->
p_conn_cells
);
cell_queue_clear
(
&
ocirc
->
p_conn_cells
);
}
}
if
(
circ
->
n_hop
)
extend_info_free
(
circ
->
n_hop
);
extend_info_free
(
circ
->
n_hop
);
tor_free
(
circ
->
n_conn_onionskin
);
tor_free
(
circ
->
n_conn_onionskin
);
/* Remove from map. */
/* Remove from map. */
...
@@ -549,10 +541,10 @@ circuit_free_all(void)
...
@@ -549,10 +541,10 @@ circuit_free_all(void)
circuit_free
(
global_circuitlist
);
circuit_free
(
global_circuitlist
);
global_circuitlist
=
next
;
global_circuitlist
=
next
;
}
}
if
(
circuits_pending_or_conns
)
{
smartlist_free
(
circuits_pending_or_conns
);
smartlist_free
(
circuits_pending_or_conns
);
circuits_pending_or_conns
=
NULL
;
circuits_pending_or_conns
=
NULL
;
}
HT_CLEAR
(
orconn_circid_map
,
&
orconn_circid_circuit_map
);
HT_CLEAR
(
orconn_circid_map
,
&
orconn_circid_circuit_map
);
}
}
...
@@ -563,18 +555,12 @@ circuit_free_cpath_node(crypt_path_t *victim)
...
@@ -563,18 +555,12 @@ circuit_free_cpath_node(crypt_path_t *victim)
if
(
!
victim
)
if
(
!
victim
)
return
;
return
;
if
(
victim
->
f_crypto
)
crypto_free_cipher_env
(
victim
->
f_crypto
);
crypto_free_cipher_env
(
victim
->
f_crypto
);
crypto_free_cipher_env
(
victim
->
b_crypto
);
if
(
victim
->
b_crypto
)
crypto_free_digest_env
(
victim
->
f_digest
);
crypto_free_cipher_env
(
victim
->
b_crypto
);
crypto_free_digest_env
(
victim
->
b_digest
);
if
(
victim
->
f_digest
)
crypto_dh_free
(
victim
->
dh_handshake_state
);
crypto_free_digest_env
(
victim
->
f_digest
);
extend_info_free
(
victim
->
extend_info
);
if
(
victim
->
b_digest
)
crypto_free_digest_env
(
victim
->
b_digest
);
if
(
victim
->
dh_handshake_state
)
crypto_dh_free
(
victim
->
dh_handshake_state
);
if
(
victim
->
extend_info
)
extend_info_free
(
victim
->
extend_info
);
memset
(
victim
,
0xBB
,
sizeof
(
crypt_path_t
));
/* poison memory */
memset
(
victim
,
0xBB
,
sizeof
(
crypt_path_t
));
/* poison memory */
tor_free
(
victim
);
tor_free
(
victim
);
...
...
src/or/circuituse.c
View file @
0c1b3070
...
@@ -928,8 +928,8 @@ circuit_launch_by_router(uint8_t purpose,
...
@@ -928,8 +928,8 @@ circuit_launch_by_router(uint8_t purpose,
if
(
exit
)
if
(
exit
)
info
=
extend_info_from_router
(
exit
);
info
=
extend_info_from_router
(
exit
);
circ
=
circuit_launch_by_extend_info
(
purpose
,
info
,
flags
);
circ
=
circuit_launch_by_extend_info
(
purpose
,
info
,
flags
);
if
(
info
)
extend_info_free
(
info
);
extend_info_free
(
info
);
return
circ
;
return
circ
;
}
}
...
@@ -1222,8 +1222,7 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn,
...
@@ -1222,8 +1222,7 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn,
flags
);
flags
);
}
}
if
(
extend_info
)
extend_info_free
(
extend_info
);
extend_info_free
(
extend_info
);
if
(
desired_circuit_purpose
!=
CIRCUIT_PURPOSE_C_GENERAL
)
{
if
(
desired_circuit_purpose
!=
CIRCUIT_PURPOSE_C_GENERAL
)
{
/* help predict this next time */
/* help predict this next time */
...
...
src/or/config.c
View file @
0c1b3070
...
@@ -827,8 +827,8 @@ set_options(or_options_t *new_val, char **msg)
...
@@ -827,8 +827,8 @@ set_options(or_options_t *new_val, char **msg)
"Acting on config options left us in a broken state. Dying."
);
"Acting on config options left us in a broken state. Dying."
);
exit
(
1
);
exit
(
1
);
}
}
if
(
old_options
)
config_free
(
&
options_format
,
old_options
);
config_free
(
&
options_format
,
old_options
);
return
0
;
return
0
;
}
}
...
@@ -862,8 +862,7 @@ or_options_free(or_options_t *options)
...
@@ -862,8 +862,7 @@ or_options_free(or_options_t *options)
if
(
!
options
)
if
(
!
options
)
return
;
return
;
if
(
options
->
_ExcludeExitNodesUnion
)
routerset_free
(
options
->
_ExcludeExitNodesUnion
);
routerset_free
(
options
->
_ExcludeExitNodesUnion
);
config_free
(
&
options_format
,
options
);
config_free
(
&
options_format
,
options
);
}
}
...
@@ -872,18 +871,15 @@ or_options_free(or_options_t *options)
...
@@ -872,18 +871,15 @@ or_options_free(or_options_t *options)
void
void
config_free_all
(
void
)
config_free_all
(
void
)
{
{
if
(
global_options
)
{
or_options_free
(
global_options
);
or_options_free
(
global_options
);
global_options
=
NULL
;
global_options
=
NULL
;
}
config_free
(
&
state_format
,
global_state
);
if
(
global_state
)
{
global_state
=
NULL
;
config_free
(
&
state_format
,
global_state
);
global_state
=
NULL
;
config_free_lines
(
global_cmdline_options
);
}
global_cmdline_options
=
NULL
;
if
(
global_cmdline_options
)
{
config_free_lines
(
global_cmdline_options
);
global_cmdline_options
=
NULL
;
}
tor_free
(
torrc_fname
);
tor_free
(
torrc_fname
);
tor_free
(
_version
);
tor_free
(
_version
);
tor_free
(
global_dirfrontpagecontents
);
tor_free
(
global_dirfrontpagecontents
);
...
@@ -5089,8 +5085,7 @@ or_state_set(or_state_t *new_state)
...
@@ -5089,8 +5085,7 @@ or_state_set(or_state_t *new_state)
{
{
char
*
err
=
NULL
;
char
*
err
=
NULL
;
tor_assert
(
new_state
);
tor_assert
(
new_state
);
if
(
global_state
)
config_free
(
&
state_format
,
global_state
);
config_free
(
&
state_format
,
global_state
);
global_state
=
new_state
;
global_state
=
new_state
;
if
(
entry_guards_parse_state
(
global_state
,
1
,
&
err
)
<
0
)
{
if
(
entry_guards_parse_state
(
global_state
,
1
,
&
err
)
<
0
)
{
log_warn
(
LD_GENERAL
,
"%s"
,
err
);
log_warn
(
LD_GENERAL
,
"%s"
,
err
);
...
...
src/or/connection.c
View file @
0c1b3070
...
@@ -371,14 +371,10 @@ _connection_free(connection_t *conn)
...
@@ -371,14 +371,10 @@ _connection_free(connection_t *conn)
if
(
connection_speaks_cells
(
conn
))
{
if
(
connection_speaks_cells
(
conn
))
{
or_connection_t
*
or_conn
=
TO_OR_CONN
(
conn
);
or_connection_t
*
or_conn
=
TO_OR_CONN
(
conn
);
if
(
or_conn
->
tls
)
{
tor_tls_free
(
or_conn
->
tls
);
tor_tls_free
(
or_conn
->
tls
);
or_conn
->
tls
=
NULL
;
or_conn
->
tls
=
NULL
;
or_handshake_state_free
(
or_conn
->
handshake_state
);
}
or_conn
->
handshake_state
=
NULL
;
if
(
or_conn
->
handshake_state
)
{
or_handshake_state_free
(
or_conn
->
handshake_state
);
or_conn
->
handshake_state
=
NULL
;
}
tor_free
(
or_conn
->
nickname
);
tor_free
(
or_conn
->
nickname
);
}
}
if
(
CONN_IS_EDGE
(
conn
))
{
if
(
CONN_IS_EDGE
(
conn
))
{
...
@@ -388,8 +384,8 @@ _connection_free(connection_t *conn)
...
@@ -388,8 +384,8 @@ _connection_free(connection_t *conn)
memset
(
edge_conn
->
socks_request
,
0xcc
,
sizeof
(
socks_request_t
));
memset
(
edge_conn
->
socks_request
,
0xcc
,
sizeof
(
socks_request_t
));
tor_free
(
edge_conn
->
socks_request
);
tor_free
(
edge_conn
->
socks_request
);
}
}
if
(
edge_conn
->
rend_data
)
rend_data_free
(
edge_conn
->
rend_data
);
rend_data_free
(
edge_conn
->
rend_data
);
}
}
if
(
conn
->
type
==
CONN_TYPE_CONTROL
)
{
if
(
conn
->
type
==
CONN_TYPE_CONTROL
)
{
control_connection_t
*
control_conn
=
TO_CONTROL_CONN
(
conn
);
control_connection_t
*
control_conn
=
TO_CONTROL_CONN
(
conn
);
...
@@ -402,16 +398,15 @@ _connection_free(connection_t *conn)
...
@@ -402,16 +398,15 @@ _connection_free(connection_t *conn)
if
(
conn
->
type
==
CONN_TYPE_DIR
)
{
if
(
conn
->
type
==
CONN_TYPE_DIR
)
{
dir_connection_t
*
dir_conn
=
TO_DIR_CONN
(
conn
);
dir_connection_t
*
dir_conn
=
TO_DIR_CONN
(
conn
);
tor_free
(
dir_conn
->
requested_resource
);
tor_free
(
dir_conn
->
requested_resource
);
if
(
dir_conn
->
zlib_state
)
tor_zlib_free
(
dir_conn
->
zlib_state
);
tor_zlib_free
(
dir_conn
->
zlib_state
);
if
(
dir_conn
->
fingerprint_stack
)
{
if
(
dir_conn
->
fingerprint_stack
)
{
SMARTLIST_FOREACH
(
dir_conn
->
fingerprint_stack
,
char
*
,
cp
,
tor_free
(
cp
));
SMARTLIST_FOREACH
(
dir_conn
->
fingerprint_stack
,
char
*
,
cp
,
tor_free
(
cp
));
smartlist_free
(
dir_conn
->
fingerprint_stack
);
smartlist_free
(
dir_conn
->
fingerprint_stack
);
}
}
if
(
dir_conn
->
cached_dir
)
cached_dir_decref
(
dir_conn
->
cached_dir
);
cached_dir_decref
(
dir_conn
->
cached_dir
);
if
(
dir_conn
->
rend_data
)
rend_data_free
(
dir_conn
->
rend_data
);
rend_data_free
(
dir_conn
->
rend_data
);
}
}
if
(
conn
->
s
>=
0
)
{
if
(
conn
->
s
>=
0
)
{
...
...
src/or/connection_edge.c
View file @
0c1b3070
...
@@ -795,14 +795,11 @@ addressmap_clean(time_t now)
...
@@ -795,14 +795,11 @@ addressmap_clean(time_t now)
void
void
addressmap_free_all
(
void
)
addressmap_free_all
(
void
)
{
{
if
(
addressmap
)
{
strmap_free
(
addressmap
,
addressmap_ent_free
);
strmap_free
(
addressmap
,
addressmap_ent_free
);
addressmap
=
NULL
;
addressmap
=
NULL
;
}
strmap_free
(
virtaddress_reversemap
,
addressmap_virtaddress_ent_free
);
if
(
virtaddress_reversemap
)
{
virtaddress_reversemap
=
NULL
;
strmap_free
(
virtaddress_reversemap
,
addressmap_virtaddress_ent_free
);
virtaddress_reversemap
=
NULL
;
}
}
}
/** Look at address, and rewrite it until it doesn't want any
/** Look at address, and rewrite it until it doesn't want any
...
...
src/or/connection_or.c
View file @
0c1b3070
...
@@ -80,10 +80,9 @@ connection_or_clear_identity_map(void)
...
@@ -80,10 +80,9 @@ connection_or_clear_identity_map(void)
}
}
});
});
if
(
orconn_identity_map
)
{
digestmap_free
(
orconn_identity_map
,
NULL
);
digestmap_free
(
orconn_identity_map
,
NULL
);
orconn_identity_map
=
NULL
;
orconn_identity_map
=
NULL
;
}
}
}
/** Change conn->identity_digest to digest, and add conn into
/** Change conn->identity_digest to digest, and add conn into
...
@@ -1118,10 +1117,10 @@ connection_or_set_state_open(or_connection_t *conn)
...
@@ -1118,10 +1117,10 @@ connection_or_set_state_open(or_connection_t *conn)
}
}
}
}
}
}
if
(
conn
->
handshake_state
)
{
or_handshake_state_free
(
conn
->
handshake_state
);
or_handshake_state_free
(
conn
->
handshake_state
);
conn
->
handshake_state
=
NULL
;
conn
->
handshake_state
=
NULL
;
}
connection_start_reading
(
TO_CONN
(
conn
));
connection_start_reading
(
TO_CONN
(
conn
));
circuit_n_conn_done
(
conn
,
1
);
/* send the pending creates, if any. */
circuit_n_conn_done
(
conn
,
1
);
/* send the pending creates, if any. */
...
...
src/or/control.c
View file @
0c1b3070
...
@@ -2143,8 +2143,7 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
...
@@ -2143,8 +2143,7 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
done:
done:
SMARTLIST_FOREACH
(
router_nicknames
,
char
*
,
n
,
tor_free
(
n
));
SMARTLIST_FOREACH
(
router_nicknames
,
char
*
,
n
,
tor_free
(
n
));
smartlist_free
(
router_nicknames
);
smartlist_free
(
router_nicknames
);
if
(
routers
)
smartlist_free
(
routers
);
smartlist_free
(
routers
);
return
0
;
return
0
;
}
}
...
...
src/or/dirserv.c
View file @
0c1b3070
...
@@ -2818,10 +2818,8 @@ generate_v2_networkstatus_opinion(void)
...
@@ -2818,10 +2818,8 @@ generate_v2_networkstatus_opinion(void)
tor_free
(
status
);
tor_free
(
status
);
tor_free
(
hostname
);
tor_free
(
hostname
);
tor_free
(
identity_pkey
);
tor_free
(
identity_pkey
);
if
(
routers
)
smartlist_free
(
routers
);
smartlist_free
(
routers
);
digestmap_free
(
omit_as_sybil
,
NULL
);
if
(
omit_as_sybil
)
digestmap_free
(
omit_as_sybil
,
NULL
);
return
r
;
return
r
;
}
}
...
@@ -3497,8 +3495,7 @@ connection_dirserv_add_networkstatus_bytes_to_outbuf(dir_connection_t *conn)
...
@@ -3497,8 +3495,7 @@ connection_dirserv_add_networkstatus_bytes_to_outbuf(dir_connection_t *conn)
}
}
}
else
{
}
else
{
connection_dirserv_finish_spooling
(
conn
);
connection_dirserv_finish_spooling
(
conn
);
if
(
conn
->
fingerprint_stack
)
smartlist_free
(
conn
->
fingerprint_stack
);
smartlist_free
(
conn
->
fingerprint_stack
);
conn
->
fingerprint_stack
=
NULL
;
conn
->
fingerprint_stack
=
NULL
;
return
0
;
return
0
;
}
}
...
@@ -3545,13 +3542,10 @@ dirserv_free_all(void)
...
@@ -3545,13 +3542,10 @@ dirserv_free_all(void)
cached_dir_decref
(
the_v2_networkstatus
);
cached_dir_decref
(
the_v2_networkstatus
);
cached_dir_decref
(
cached_directory
);
cached_dir_decref
(
cached_directory
);
clear_cached_dir
(
&
cached_runningrouters
);
clear_cached_dir
(
&
cached_runningrouters
);
if
(
cached_v2_networkstatus
)
{
digestmap_free
(
cached_v2_networkstatus
,
_free_cached_dir
);
digestmap_free
(
cached_v2_networkstatus
,
_free_cached_dir
);
cached_v2_networkstatus
=
NULL
;
cached_v2_networkstatus
=
NULL
;
}
strmap_free
(
cached_consensuses
,
_free_cached_dir
);
if
(
cached_consensuses
)
{
cached_consensuses
=
NULL
;
strmap_free
(
cached_consensuses
,
_free_cached_dir
);
cached_consensuses
=
NULL
;
}
}
}
src/or/dirvote.c
View file @
0c1b3070
...
@@ -2062,10 +2062,9 @@ dirvote_clear_pending_consensuses(void)
...
@@ -2062,10 +2062,9 @@ dirvote_clear_pending_consensuses(void)
for
(
i
=
0
;
i
<
N_CONSENSUS_FLAVORS
;
++
i
)
{
for
(
i
=
0
;
i
<
N_CONSENSUS_FLAVORS
;
++
i
)
{
pending_consensus_t
*
pc
=
&
pending_consensuses
[
i
];
pending_consensus_t
*
pc
=
&
pending_consensuses
[
i
];
tor_free
(
pc
->
body
);
tor_free
(
pc
->
body
);
if
(
pc
->
consensus
)
{
networkstatus_vote_free
(
pc
->
consensus
);
networkstatus_vote_free
(
pc
->
consensus
);
pc
->
consensus
=
NULL
;
pc
->
consensus
=
NULL
;
}
}
}
}
}
...
@@ -2267,8 +2266,7 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
...
@@ -2267,8 +2266,7 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
*
status_out
=
400
;
*
status_out
=
400
;
discard:
discard:
if
(
vote
)
networkstatus_vote_free
(
vote
);
networkstatus_vote_free
(
vote
);
if
(
end_of_vote
&&
!
strcmpstart
(
end_of_vote
,
"network-status-version "
))
{
if
(
end_of_vote
&&
!
strcmpstart
(
end_of_vote
,
"network-status-version "
))
{
vote_body
=
end_of_vote
;
vote_body
=
end_of_vote
;
...
@@ -2453,8 +2451,7 @@ dirvote_compute_consensuses(void)
...
@@ -2453,8 +2451,7 @@ dirvote_compute_consensuses(void)
return
0
;
return
0
;
err:
err:
if
(
votes
)
smartlist_free
(
votes
);
smartlist_free
(
votes
);
tor_free
(
consensus_body
);
tor_free
(
consensus_body
);
tor_free
(
signatures
);
tor_free
(
signatures
);
networkstatus_vote_free
(
consensus
);
networkstatus_vote_free
(
consensus
);
...
@@ -2582,8 +2579,7 @@ dirvote_add_signatures_to_all_pending_consensuses(
...
@@ -2582,8 +2579,7 @@ dirvote_add_signatures_to_all_pending_consensuses(
if
(
!*
msg_out
)
if
(
!*
msg_out
)
*
msg_out
=
"Unrecognized error while adding detached signatures."
;
*
msg_out
=
"Unrecognized error while adding detached signatures."
;
done:
done:
if
(
sigs
)
ns_detached_signatures_free
(
sigs
);
ns_detached_signatures_free
(
sigs
);
/* XXXX NM Check how return is used. We can now have an error *and*
/* XXXX NM Check how return is used. We can now have an error *and*
signatures added. */
signatures added. */
return
r
;
return
r
;
...
...
src/or/dns.c
View file @
0c1b3070
...
@@ -366,8 +366,7 @@ dns_free_all(void)
...
@@ -366,8 +366,7 @@ dns_free_all(void)
_free_cached_resolve
(
item
);
_free_cached_resolve
(
item
);
}
}
HT_CLEAR
(
cache_map
,
&
cache_root
);
HT_CLEAR
(
cache_map
,
&
cache_root
);
if
(
cached_resolve_pqueue
)
smartlist_free
(
cached_resolve_pqueue
);
smartlist_free
(
cached_resolve_pqueue
);
cached_resolve_pqueue
=
NULL
;
cached_resolve_pqueue
=
NULL
;
tor_free
(
resolv_conf_fname
);
tor_free
(
resolv_conf_fname
);
}
}
...
@@ -1644,10 +1643,9 @@ dns_seems_to_be_broken(void)
...
@@ -1644,10 +1643,9 @@ dns_seems_to_be_broken(void)
void
void
dns_reset_correctness_checks
(
void
)
dns_reset_correctness_checks
(
void
)
{
{
if
(
dns_wildcard_response_count
)
{
strmap_free
(
dns_wildcard_response_count
,
_tor_free
);
strmap_free
(
dns_wildcard_response_count
,
_tor_free
);
dns_wildcard_response_count
=
NULL
;
dns_wildcard_response_count
=
NULL
;
}
n_wildcard_requests
=
0
;
n_wildcard_requests
=
0
;