Convert the rest of src/common's headers to use FREE_AND_NULL
This commit is contained in:
parent
2f086888b1
commit
c92ac9f5cb
|
@ -1759,14 +1759,14 @@ get_interface_address6,(int severity, sa_family_t family, tor_addr_t *addr))
|
|||
break;
|
||||
} SMARTLIST_FOREACH_END(a);
|
||||
|
||||
free_interface_address6_list(addrs);
|
||||
interface_address6_list_free(addrs);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/** Free a smartlist of IP addresses returned by get_interface_address6_list.
|
||||
*/
|
||||
void
|
||||
free_interface_address6_list(smartlist_t *addrs)
|
||||
interface_address6_list_free_(smartlist_t *addrs)
|
||||
{
|
||||
if (addrs != NULL) {
|
||||
SMARTLIST_FOREACH(addrs, tor_addr_t *, a, tor_free(a));
|
||||
|
@ -1781,7 +1781,7 @@ free_interface_address6_list(smartlist_t *addrs)
|
|||
* An empty smartlist means that there are no addresses of the selected type
|
||||
* matching these criteria.
|
||||
* Returns NULL on failure.
|
||||
* Use free_interface_address6_list to free the returned list.
|
||||
* Use interface_address6_list_free to free the returned list.
|
||||
*/
|
||||
MOCK_IMPL(smartlist_t *,
|
||||
get_interface_address6_list,(int severity,
|
||||
|
|
|
@ -206,7 +206,9 @@ const char * fmt_addr32(uint32_t addr);
|
|||
|
||||
MOCK_DECL(int,get_interface_address6,(int severity, sa_family_t family,
|
||||
tor_addr_t *addr));
|
||||
void free_interface_address6_list(smartlist_t * addrs);
|
||||
void interface_address6_list_free_(smartlist_t * addrs);// XXXX
|
||||
#define interface_address6_list_free(addrs) \
|
||||
FREE_AND_NULL(interface_address6_list, (addrs))
|
||||
MOCK_DECL(smartlist_t *,get_interface_address6_list,(int severity,
|
||||
sa_family_t family,
|
||||
int include_internal));
|
||||
|
@ -321,13 +323,8 @@ int addr_mask_get_bits(uint32_t mask);
|
|||
int tor_inet_ntoa(const struct in_addr *in, char *buf, size_t buf_len);
|
||||
char *tor_dup_ip(uint32_t addr) ATTR_MALLOC;
|
||||
MOCK_DECL(int,get_interface_address,(int severity, uint32_t *addr));
|
||||
/** Free a smartlist of IP addresses returned by get_interface_address_list.
|
||||
*/
|
||||
static inline void
|
||||
free_interface_address_list(smartlist_t *addrs)
|
||||
{
|
||||
free_interface_address6_list(addrs);
|
||||
}
|
||||
#define interface_address_list_free(lst)\
|
||||
interface_address6_list_free(lst)
|
||||
/** Return a smartlist of the IPv4 addresses of all interfaces on the server.
|
||||
* Excludes loopback and multicast addresses. Only includes internal addresses
|
||||
* if include_internal is true. (Note that a relay behind NAT may use an
|
||||
|
|
|
@ -110,7 +110,7 @@ aes_new_cipher(const uint8_t *key, const uint8_t *iv, int key_bits)
|
|||
return (aes_cnt_cipher_t *) cipher;
|
||||
}
|
||||
void
|
||||
aes_cipher_free(aes_cnt_cipher_t *cipher_)
|
||||
aes_cipher_free_(aes_cnt_cipher_t *cipher_)
|
||||
{
|
||||
if (!cipher_)
|
||||
return;
|
||||
|
@ -324,7 +324,7 @@ aes_set_key(aes_cnt_cipher_t *cipher, const uint8_t *key, int key_bits)
|
|||
/** Release storage held by <b>cipher</b>
|
||||
*/
|
||||
void
|
||||
aes_cipher_free(aes_cnt_cipher_t *cipher)
|
||||
aes_cipher_free_(aes_cnt_cipher_t *cipher)
|
||||
{
|
||||
if (!cipher)
|
||||
return;
|
||||
|
|
|
@ -17,7 +17,8 @@ typedef struct aes_cnt_cipher aes_cnt_cipher_t;
|
|||
|
||||
aes_cnt_cipher_t* aes_new_cipher(const uint8_t *key, const uint8_t *iv,
|
||||
int key_bits);
|
||||
void aes_cipher_free(aes_cnt_cipher_t *cipher);
|
||||
void aes_cipher_free_(aes_cnt_cipher_t *cipher);
|
||||
#define aes_cipher_free(cipher) FREE_AND_NULL(aes_cipher, (cipher))
|
||||
void aes_crypt_inplace(aes_cnt_cipher_t *cipher, char *data, size_t len);
|
||||
|
||||
int evaluate_evp_for_aes(int force_value);
|
||||
|
|
|
@ -409,7 +409,7 @@ buf_slack(const buf_t *buf)
|
|||
|
||||
/** Release storage held by <b>buf</b>. */
|
||||
void
|
||||
buf_free(buf_t *buf)
|
||||
buf_free_(buf_t *buf)
|
||||
{
|
||||
if (!buf)
|
||||
return;
|
||||
|
|
|
@ -24,7 +24,8 @@ struct tor_compress_state_t;
|
|||
buf_t *buf_new(void);
|
||||
buf_t *buf_new_with_capacity(size_t size);
|
||||
size_t buf_get_default_chunk_size(const buf_t *buf);
|
||||
void buf_free(buf_t *buf);
|
||||
void buf_free_(buf_t *buf);
|
||||
#define buf_free(b) FREE_AND_NULL(buf, (b))
|
||||
void buf_clear(buf_t *buf);
|
||||
buf_t *buf_copy(const buf_t *buf);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ suppress_libevent_log_msg(const char *msg)
|
|||
|
||||
/* Wrapper for event_free() that tolerates tor_event_free(NULL) */
|
||||
void
|
||||
tor_event_free(struct event *ev)
|
||||
tor_event_free_(struct event *ev)
|
||||
{
|
||||
if (ev == NULL)
|
||||
return;
|
||||
|
@ -213,7 +213,7 @@ periodic_timer_new(struct event_base *base,
|
|||
|
||||
/** Stop and free a periodic timer */
|
||||
void
|
||||
periodic_timer_free(periodic_timer_t *timer)
|
||||
periodic_timer_free_(periodic_timer_t *timer)
|
||||
{
|
||||
if (!timer)
|
||||
return;
|
||||
|
|
|
@ -19,7 +19,8 @@ void suppress_libevent_log_msg(const char *msg);
|
|||
evdns_add_server_port_with_base(tor_libevent_get_base(), \
|
||||
(sock),(tcp),(cb),(data));
|
||||
|
||||
void tor_event_free(struct event *ev);
|
||||
void tor_event_free_(struct event *ev);
|
||||
#define tor_event_free(ev) FREE_AND_NULL(tor_event, (ev))
|
||||
|
||||
typedef struct periodic_timer_t periodic_timer_t;
|
||||
|
||||
|
@ -27,7 +28,8 @@ periodic_timer_t *periodic_timer_new(struct event_base *base,
|
|||
const struct timeval *tv,
|
||||
void (*cb)(periodic_timer_t *timer, void *data),
|
||||
void *data);
|
||||
void periodic_timer_free(periodic_timer_t *);
|
||||
void periodic_timer_free_(periodic_timer_t *);
|
||||
#define periodic_timer_free(t) FREE_AND_NULL(periodic_timer, (t))
|
||||
|
||||
#define tor_event_base_loopexit event_base_loopexit
|
||||
#define tor_event_base_loopbreak event_base_loopbreak
|
||||
|
|
|
@ -48,7 +48,7 @@ tor_mutex_new_nonrecursive(void)
|
|||
}
|
||||
/** Release all storage and system resources held by <b>m</b>. */
|
||||
void
|
||||
tor_mutex_free(tor_mutex_t *m)
|
||||
tor_mutex_free_(tor_mutex_t *m)
|
||||
{
|
||||
if (!m)
|
||||
return;
|
||||
|
@ -68,7 +68,7 @@ tor_cond_new(void)
|
|||
|
||||
/** Free all storage held in <b>c</b>. */
|
||||
void
|
||||
tor_cond_free(tor_cond_t *c)
|
||||
tor_cond_free_(tor_cond_t *c)
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
|
|
|
@ -50,7 +50,8 @@ void tor_mutex_init(tor_mutex_t *m);
|
|||
void tor_mutex_init_nonrecursive(tor_mutex_t *m);
|
||||
void tor_mutex_acquire(tor_mutex_t *m);
|
||||
void tor_mutex_release(tor_mutex_t *m);
|
||||
void tor_mutex_free(tor_mutex_t *m);
|
||||
void tor_mutex_free_(tor_mutex_t *m);
|
||||
#define tor_mutex_free(m) FREE_AND_NULL(tor_mutex, (m))
|
||||
void tor_mutex_uninit(tor_mutex_t *m);
|
||||
unsigned long tor_get_thread_id(void);
|
||||
void tor_threads_init(void);
|
||||
|
@ -77,7 +78,8 @@ typedef struct tor_cond_t {
|
|||
} tor_cond_t;
|
||||
|
||||
tor_cond_t *tor_cond_new(void);
|
||||
void tor_cond_free(tor_cond_t *cond);
|
||||
void tor_cond_free_(tor_cond_t *cond);
|
||||
#define tor_cond_free(c) FREE_AND_NULL(tor_cond, (c))
|
||||
int tor_cond_init(tor_cond_t *cond);
|
||||
void tor_cond_uninit(tor_cond_t *cond);
|
||||
int tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex,
|
||||
|
|
|
@ -598,7 +598,7 @@ tor_compress_process(tor_compress_state_t *state,
|
|||
|
||||
/** Deallocate <b>state</b>. */
|
||||
void
|
||||
tor_compress_free(tor_compress_state_t *state)
|
||||
tor_compress_free_(tor_compress_state_t *state)
|
||||
{
|
||||
if (state == NULL)
|
||||
return;
|
||||
|
|
|
@ -80,7 +80,8 @@ tor_compress_output_t tor_compress_process(tor_compress_state_t *state,
|
|||
char **out, size_t *out_len,
|
||||
const char **in, size_t *in_len,
|
||||
int finish);
|
||||
void tor_compress_free(tor_compress_state_t *state);
|
||||
void tor_compress_free_(tor_compress_state_t *state);
|
||||
#define tor_compress_free(st) FREE_AND_NULL(tor_compress, (st))
|
||||
|
||||
size_t tor_compress_state_size(const tor_compress_state_t *state);
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ tor_lzma_compress_process(tor_lzma_compress_state_t *state,
|
|||
|
||||
/** Deallocate <b>state</b>. */
|
||||
void
|
||||
tor_lzma_compress_free(tor_lzma_compress_state_t *state)
|
||||
tor_lzma_compress_free_(tor_lzma_compress_state_t *state)
|
||||
{
|
||||
if (state == NULL)
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,8 @@ tor_lzma_compress_process(tor_lzma_compress_state_t *state,
|
|||
const char **in, size_t *in_len,
|
||||
int finish);
|
||||
|
||||
void tor_lzma_compress_free(tor_lzma_compress_state_t *state);
|
||||
void tor_lzma_compress_free_(tor_lzma_compress_state_t *state);
|
||||
#define tor_lzma_compress_free(st) FREE_AND_NULL(tor_lzma_compress, (st))
|
||||
|
||||
size_t tor_lzma_compress_state_size(const tor_lzma_compress_state_t *state);
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ tor_zlib_compress_process(tor_zlib_compress_state_t *state,
|
|||
|
||||
/** Deallocate <b>state</b>. */
|
||||
void
|
||||
tor_zlib_compress_free(tor_zlib_compress_state_t *state)
|
||||
tor_zlib_compress_free_(tor_zlib_compress_state_t *state)
|
||||
{
|
||||
if (state == NULL)
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,8 @@ tor_zlib_compress_process(tor_zlib_compress_state_t *state,
|
|||
const char **in, size_t *in_len,
|
||||
int finish);
|
||||
|
||||
void tor_zlib_compress_free(tor_zlib_compress_state_t *state);
|
||||
void tor_zlib_compress_free_(tor_zlib_compress_state_t *state);
|
||||
#define tor_zlib_compress_free(st) FREE_AND_NULL(tor_zlib_compress, (st))
|
||||
|
||||
size_t tor_zlib_compress_state_size(const tor_zlib_compress_state_t *state);
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state,
|
|||
|
||||
/** Deallocate <b>state</b>. */
|
||||
void
|
||||
tor_zstd_compress_free(tor_zstd_compress_state_t *state)
|
||||
tor_zstd_compress_free_(tor_zstd_compress_state_t *state)
|
||||
{
|
||||
if (state == NULL)
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,8 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state,
|
|||
const char **in, size_t *in_len,
|
||||
int finish);
|
||||
|
||||
void tor_zstd_compress_free(tor_zstd_compress_state_t *state);
|
||||
void tor_zstd_compress_free_(tor_zstd_compress_state_t *state);
|
||||
#define tor_zstd_compress_free(st) FREE_AND_NULL(tor_zstd_compress, (st))
|
||||
|
||||
size_t tor_zstd_compress_state_size(const tor_zstd_compress_state_t *state);
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ config_process_include(const char *path, int recursion_level, int extended,
|
|||
* Free all the configuration lines on the linked list <b>front</b>.
|
||||
*/
|
||||
void
|
||||
config_free_lines(config_line_t *front)
|
||||
config_free_lines_(config_line_t *front)
|
||||
{
|
||||
config_line_t *tmp;
|
||||
|
||||
|
|
|
@ -48,7 +48,12 @@ int config_get_lines(const char *string, config_line_t **result, int extended);
|
|||
int config_get_lines_include(const char *string, config_line_t **result,
|
||||
int extended, int *has_include,
|
||||
smartlist_t *opened_lst);
|
||||
void config_free_lines(config_line_t *front);
|
||||
void config_free_lines_(config_line_t *front);
|
||||
#define config_free_lines(front) \
|
||||
do { \
|
||||
config_free_lines_(front); \
|
||||
(front) = NULL; \
|
||||
} while (0)
|
||||
const char *parse_config_line_from_str_verbose(const char *line,
|
||||
char **key_out, char **value_out,
|
||||
const char **err_out);
|
||||
|
|
|
@ -148,7 +148,7 @@ struct di_digest256_map_t {
|
|||
/** Release all storage held in <b>map</b>, calling free_fn on each value
|
||||
* as we go. */
|
||||
void
|
||||
dimap_free(di_digest256_map_t *map, dimap_free_fn free_fn)
|
||||
dimap_free_(di_digest256_map_t *map, dimap_free_fn free_fn)
|
||||
{
|
||||
while (map) {
|
||||
di_digest256_map_t *victim = map;
|
||||
|
|
|
@ -37,7 +37,12 @@ int safe_mem_is_zero(const void *mem, size_t sz);
|
|||
typedef struct di_digest256_map_t di_digest256_map_t;
|
||||
typedef void (*dimap_free_fn)(void *);
|
||||
|
||||
void dimap_free(di_digest256_map_t *map, dimap_free_fn free_fn);
|
||||
void dimap_free_(di_digest256_map_t *map, dimap_free_fn free_fn);
|
||||
#define dimap_free(map, free_fn) \
|
||||
do { \
|
||||
dimap_free_((map), (free_fn)); \
|
||||
(map) = NULL; \
|
||||
} while (0)
|
||||
void dimap_add_entry(di_digest256_map_t **map,
|
||||
const uint8_t *key, void *val);
|
||||
void *dimap_search(const di_digest256_map_t *map, const uint8_t *key,
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#define HANDLE_DECL(name, structname, linkage) \
|
||||
typedef struct name ## _handle_t name ## _handle_t; \
|
||||
linkage name ## _handle_t *name ## _handle_new(struct structname *object); \
|
||||
linkage void name ## _handle_free(name ## _handle_t *); \
|
||||
linkage void name ## _handle_free_(name ## _handle_t *); \
|
||||
linkage struct structname *name ## _handle_get(name ## _handle_t *); \
|
||||
linkage void name ## _handles_clear(struct structname *object);
|
||||
|
||||
|
@ -113,7 +113,7 @@
|
|||
} \
|
||||
\
|
||||
linkage void \
|
||||
name ## _handle_free(struct name ## _handle_t *ref) \
|
||||
name ## _handle_free_(struct name ## _handle_t *ref) \
|
||||
{ \
|
||||
if (! ref) return; \
|
||||
name ## _handle_head_t *head = ref->head; \
|
||||
|
|
|
@ -63,7 +63,9 @@ typedef struct logfile_t {
|
|||
* log for each log domain? */
|
||||
} logfile_t;
|
||||
|
||||
static void log_free(logfile_t *victim);
|
||||
static void log_free_(logfile_t *victim);
|
||||
#define log_free(lg) \
|
||||
FREE_AND_NULL(log, (lg))
|
||||
|
||||
/** Helper: map a log severity to descriptive string. */
|
||||
static inline const char *
|
||||
|
@ -721,7 +723,7 @@ log_fn_ratelim_(ratelim_t *ratelim, int severity, log_domain_mask_t domain,
|
|||
|
||||
/** Free all storage held by <b>victim</b>. */
|
||||
static void
|
||||
log_free(logfile_t *victim)
|
||||
log_free_(logfile_t *victim)
|
||||
{
|
||||
if (!victim)
|
||||
return;
|
||||
|
|
|
@ -153,7 +153,7 @@ memarea_new(void)
|
|||
/** Free <b>area</b>, invalidating all pointers returned from memarea_alloc()
|
||||
* and friends for this area */
|
||||
void
|
||||
memarea_drop_all(memarea_t *area)
|
||||
memarea_drop_all_(memarea_t *area)
|
||||
{
|
||||
memarea_chunk_t *chunk, *next;
|
||||
for (chunk = area->first; chunk; chunk = next) {
|
||||
|
|
|
@ -8,7 +8,12 @@
|
|||
typedef struct memarea_t memarea_t;
|
||||
|
||||
memarea_t *memarea_new(void);
|
||||
void memarea_drop_all(memarea_t *area);
|
||||
void memarea_drop_all_(memarea_t *area);
|
||||
#define memarea_drop_all(area) \
|
||||
do { \
|
||||
memarea_drop_all_(area); \
|
||||
(area) = NULL; \
|
||||
} while (0)
|
||||
void memarea_clear(memarea_t *area);
|
||||
int memarea_owns_ptr(const memarea_t *area, const void *ptr);
|
||||
void *memarea_alloc(memarea_t *area, size_t sz);
|
||||
|
|
|
@ -325,7 +325,7 @@ tor_process_monitor_poll_cb(evutil_socket_t unused1, short unused2,
|
|||
|
||||
/** Free the process-termination monitor <b>procmon</b>. */
|
||||
void
|
||||
tor_process_monitor_free(tor_process_monitor_t *procmon)
|
||||
tor_process_monitor_free_(tor_process_monitor_t *procmon)
|
||||
{
|
||||
if (procmon == NULL)
|
||||
return;
|
||||
|
|
|
@ -27,7 +27,9 @@ tor_process_monitor_t *tor_process_monitor_new(struct event_base *base,
|
|||
tor_procmon_callback_t cb,
|
||||
void *cb_arg,
|
||||
const char **msg);
|
||||
void tor_process_monitor_free(tor_process_monitor_t *procmon);
|
||||
void tor_process_monitor_free_(tor_process_monitor_t *procmon);
|
||||
#define tor_process_monitor_free(procmon) \
|
||||
FREE_AND_NULL(tor_process_monitor, (procmon))
|
||||
|
||||
#endif /* !defined(TOR_PROCMON_H) */
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ storage_dir_new(const char *dirname, int max_files)
|
|||
* Drop all in-RAM storage for <b>d</b>. Does not delete any files.
|
||||
*/
|
||||
void
|
||||
storage_dir_free(storage_dir_t *d)
|
||||
storage_dir_free_(storage_dir_t *d)
|
||||
{
|
||||
if (d == NULL)
|
||||
return;
|
||||
|
|
|
@ -9,7 +9,9 @@ struct config_line_t;
|
|||
struct sandbox_cfg_elem;
|
||||
|
||||
storage_dir_t * storage_dir_new(const char *dirname, int n_files);
|
||||
void storage_dir_free(storage_dir_t *d);
|
||||
void storage_dir_free_(storage_dir_t *d);
|
||||
#define storage_dir_free(d) FREE_AND_NULL(storage_dir, (d))
|
||||
|
||||
int storage_dir_register_with_sandbox(storage_dir_t *d,
|
||||
struct sandbox_cfg_elem **cfg);
|
||||
const smartlist_t *storage_dir_list(storage_dir_t *d);
|
||||
|
|
|
@ -245,7 +245,7 @@ timer_new(timer_cb_fn_t cb, void *arg)
|
|||
* scheduled.
|
||||
*/
|
||||
void
|
||||
timer_free(tor_timer_t *t)
|
||||
timer_free_(tor_timer_t *t)
|
||||
{
|
||||
if (! t)
|
||||
return;
|
||||
|
|
|
@ -17,7 +17,8 @@ void timer_get_cb(const tor_timer_t *t,
|
|||
timer_cb_fn_t *cb_out, void **arg_out);
|
||||
void timer_schedule(tor_timer_t *t, const struct timeval *delay);
|
||||
void timer_disable(tor_timer_t *t);
|
||||
void timer_free(tor_timer_t *t);
|
||||
void timer_free_(tor_timer_t *t);
|
||||
#define timer_free(t) FREE_AND_NULL(timer, (t))
|
||||
|
||||
void timers_initialize(void);
|
||||
void timers_shutdown(void);
|
||||
|
|
|
@ -4713,7 +4713,7 @@ environment_variable_names_equal(const char *s1, const char *s2)
|
|||
/** Free <b>env</b> (assuming it was produced by
|
||||
* process_environment_make). */
|
||||
void
|
||||
process_environment_free(process_environment_t *env)
|
||||
process_environment_free_(process_environment_t *env)
|
||||
{
|
||||
if (env == NULL) return;
|
||||
|
||||
|
|
|
@ -431,7 +431,9 @@ struct process_environment_t {
|
|||
};
|
||||
|
||||
process_environment_t *process_environment_make(struct smartlist_t *env_vars);
|
||||
void process_environment_free(process_environment_t *env);
|
||||
void process_environment_free_(process_environment_t *env);
|
||||
#define process_environment_free(env) \
|
||||
FREE_AND_NULL(process_environment, (env))
|
||||
|
||||
struct smartlist_t *get_current_process_environment_variables(void);
|
||||
|
||||
|
|
|
@ -719,6 +719,8 @@ int packed_cell_is_destroy(channel_t *chan,
|
|||
|
||||
/* Declare the handle helpers */
|
||||
HANDLE_DECL(channel, channel_s,)
|
||||
#define channel_handle_free(h) \
|
||||
FREE_AND_NULL(channel_handle, (h))
|
||||
|
||||
#endif /* !defined(TOR_CHANNEL_H) */
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ typedef struct consensus_cache_entry_t consensus_cache_entry_t;
|
|||
typedef struct consensus_cache_t consensus_cache_t;
|
||||
|
||||
HANDLE_DECL(consensus_cache_entry, consensus_cache_entry_t, )
|
||||
#define consensus_cache_entry_handle_free(h) \
|
||||
FREE_AND_NULL(consensus_cache_entry_handle, (h))
|
||||
|
||||
consensus_cache_t *consensus_cache_open(const char *subdir, int max_entries);
|
||||
void consensus_cache_free(consensus_cache_t *cache);
|
||||
|
|
|
@ -476,6 +476,9 @@ STATIC double get_meaningful_restriction_threshold(void);
|
|||
STATIC double get_extreme_restriction_threshold(void);
|
||||
|
||||
HANDLE_DECL(entry_guard, entry_guard_t, STATIC)
|
||||
#define entry_guard_handle_free(h) \
|
||||
FREE_AND_NULL(entry_guard_handle, (h))
|
||||
|
||||
STATIC guard_selection_type_t guard_selection_infer_type(
|
||||
guard_selection_type_t type_in,
|
||||
const char *name);
|
||||
|
|
|
@ -1792,14 +1792,14 @@ policies_parse_exit_policy_reject_private(
|
|||
/* Reject public IPv4 addresses on any interface */
|
||||
public_addresses = get_interface_address6_list(LOG_INFO, AF_INET, 0);
|
||||
addr_policy_append_reject_addr_list_filter(dest, public_addresses, 1, 0);
|
||||
free_interface_address6_list(public_addresses);
|
||||
interface_address6_list_free(public_addresses);
|
||||
|
||||
/* Don't look for IPv6 addresses if we're configured as IPv4-only */
|
||||
if (ipv6_exit) {
|
||||
/* Reject public IPv6 addresses on any interface */
|
||||
public_addresses = get_interface_address6_list(LOG_INFO, AF_INET6, 0);
|
||||
addr_policy_append_reject_addr_list_filter(dest, public_addresses, 0, 1);
|
||||
free_interface_address6_list(public_addresses);
|
||||
interface_address6_list_free(public_addresses);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ main(int argc, char **argv)
|
|||
ret = 0;
|
||||
}
|
||||
|
||||
timer_free(NULL);
|
||||
timer_free_(NULL);
|
||||
|
||||
for (i = 0; i < N_TIMERS; ++i) {
|
||||
timer_free(timers[i]);
|
||||
|
|
|
@ -763,7 +763,7 @@ test_address_get_if_addrs_list_internal(void *arg)
|
|||
tt_assert(!smartlist_contains_ipv6_tor_addr(results));
|
||||
|
||||
done:
|
||||
free_interface_address_list(results);
|
||||
interface_address_list_free(results);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -792,7 +792,7 @@ test_address_get_if_addrs_list_no_internal(void *arg)
|
|||
tt_assert(!smartlist_contains_ipv6_tor_addr(results));
|
||||
|
||||
done:
|
||||
free_interface_address_list(results);
|
||||
interface_address_list_free(results);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -834,7 +834,7 @@ test_address_get_if_addrs6_list_internal(void *arg)
|
|||
}
|
||||
|
||||
done:
|
||||
free_interface_address6_list(results);
|
||||
interface_address6_list_free(results);
|
||||
teardown_capture_of_logs();
|
||||
return;
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ test_address_get_if_addrs6_list_no_internal(void *arg)
|
|||
|
||||
done:
|
||||
teardown_capture_of_logs();
|
||||
free_interface_address6_list(results);
|
||||
interface_address6_list_free(results);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -943,8 +943,8 @@ test_address_get_if_addrs_internal_fail(void *arg)
|
|||
done:
|
||||
UNMOCK(get_interface_addresses_raw);
|
||||
UNMOCK(get_interface_address6_via_udp_socket_hack);
|
||||
free_interface_address6_list(results1);
|
||||
free_interface_address6_list(results2);
|
||||
interface_address6_list_free(results1);
|
||||
interface_address6_list_free(results2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -971,8 +971,8 @@ test_address_get_if_addrs_no_internal_fail(void *arg)
|
|||
done:
|
||||
UNMOCK(get_interface_addresses_raw);
|
||||
UNMOCK(get_interface_address6_via_udp_socket_hack);
|
||||
free_interface_address6_list(results1);
|
||||
free_interface_address6_list(results2);
|
||||
interface_address6_list_free(results1);
|
||||
interface_address6_list_free(results2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ typedef struct demo_t {
|
|||
} demo_t;
|
||||
|
||||
HANDLE_DECL(demo, demo_t, static)
|
||||
#define demo_handle_free(h) \
|
||||
FREE_AND_NULL(demo_handle, (h))
|
||||
HANDLE_IMPL(demo, demo_t, static)
|
||||
|
||||
static demo_t *
|
||||
|
|
|
@ -1318,7 +1318,7 @@ mock_get_interface_address6_list(int severity,
|
|||
return clone_list;
|
||||
|
||||
done:
|
||||
free_interface_address6_list(clone_list);
|
||||
interface_address6_list_free(clone_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1393,11 +1393,11 @@ test_policies_reject_interface_address(void *arg)
|
|||
|
||||
done:
|
||||
addr_policy_list_free(policy);
|
||||
free_interface_address6_list(public_ipv4_addrs);
|
||||
free_interface_address6_list(public_ipv6_addrs);
|
||||
interface_address6_list_free(public_ipv4_addrs);
|
||||
interface_address6_list_free(public_ipv6_addrs);
|
||||
|
||||
UNMOCK(get_interface_address6_list);
|
||||
/* we don't use free_interface_address6_list on these lists because their
|
||||
/* we don't use interface_address6_list_free on these lists because their
|
||||
* address pointers are stack-based */
|
||||
smartlist_free(mock_ipv4_addrs);
|
||||
smartlist_free(mock_ipv6_addrs);
|
||||
|
|
Loading…
Reference in New Issue