From f5f80790d2abc1e418158827b1c8e398611d573a Mon Sep 17 00:00:00 2001 From: Tom van der Woerdt Date: Tue, 6 Jan 2015 19:39:52 +0100 Subject: [PATCH 1/3] Minor documentation fixes --- src/or/addressmap.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/or/addressmap.c b/src/or/addressmap.c index e28b5e3341..33f11cb0ec 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -94,7 +94,7 @@ addressmap_ent_free(void *_ent) tor_free(ent); } -/** Free storage held by a virtaddress_entry_t* entry in ent. */ +/** Free storage held by a virtaddress_entry_t* entry in _ent. */ static void addressmap_virtaddress_ent_free(void *_ent) { @@ -108,7 +108,8 @@ addressmap_virtaddress_ent_free(void *_ent) tor_free(ent); } -/** Free storage held by a virtaddress_entry_t* entry in ent. */ +/** Remove address (which must map to ent) from the + * virtual address map. */ static void addressmap_virtaddress_remove(const char *address, addressmap_entry_t *ent) { @@ -131,7 +132,7 @@ addressmap_virtaddress_remove(const char *address, addressmap_entry_t *ent) } /** Remove ent (which must be mapped to by address) from the - * client address maps. */ + * client address maps, and then free it. */ static void addressmap_ent_remove(const char *address, addressmap_entry_t *ent) { @@ -496,7 +497,7 @@ addressmap_have_mapping(const char *address, int update_expiry) * equal to address, or any address ending with a period followed by * address. If wildcard_addr and wildcard_new_addr are * both true, the mapping will rewrite addresses that end with - * ".address" into ones that end with ".new_address." + * ".address" into ones that end with ".new_address". * * If new_address is NULL, or new_address is equal to * address and wildcard_addr is equal to @@ -839,8 +840,8 @@ get_random_virtual_addr(const virtual_addr_conf_t *conf, tor_addr_t *addr_out) } /** Return a newly allocated string holding an address of type - * (one of RESOLVED_TYPE_{IPV4|HOSTNAME}) that has not yet been mapped, - * and that is very unlikely to be the address of any real host. + * (one of RESOLVED_TYPE_{IPV4|IPV6|HOSTNAME}) that has not yet been + * mapped, and that is very unlikely to be the address of any real host. * * May return NULL if we have run out of virtual addresses. */ From 4385211caf6ad4cf34c0a3aaaba42d81048fddf6 Mon Sep 17 00:00:00 2001 From: Tom van der Woerdt Date: Tue, 6 Jan 2015 19:40:23 +0100 Subject: [PATCH 2/3] Minor IPv6-related memory leak fixes --- src/or/addressmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/or/addressmap.c b/src/or/addressmap.c index 33f11cb0ec..ece69ea6e6 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -104,6 +104,7 @@ addressmap_virtaddress_ent_free(void *_ent) ent = _ent; tor_free(ent->ipv4_address); + tor_free(ent->ipv6_address); tor_free(ent->hostname_address); tor_free(ent); } @@ -121,9 +122,11 @@ addressmap_virtaddress_remove(const char *address, addressmap_entry_t *ent) if (ve) { if (!strcmp(address, ve->ipv4_address)) tor_free(ve->ipv4_address); + if (!strcmp(address, ve->ipv6_address)) + tor_free(ve->ipv6_address); if (!strcmp(address, ve->hostname_address)) tor_free(ve->hostname_address); - if (!ve->ipv4_address && !ve->hostname_address) { + if (!ve->ipv4_address && !ve->ipv6_address && !ve->hostname_address) { tor_free(ve); strmap_remove(virtaddress_reversemap, ent->new_address); } From 5d322e6ef6b43c587f7f9324a4d28b8446b07add Mon Sep 17 00:00:00 2001 From: Tom van der Woerdt Date: Tue, 6 Jan 2015 19:41:29 +0100 Subject: [PATCH 3/3] Whitespace fix --- src/or/addressmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/or/addressmap.c b/src/or/addressmap.c index ece69ea6e6..4b3583b660 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -539,9 +539,9 @@ addressmap_register(const char *address, char *new_address, time_t expires, if (expires > 1) { log_info(LD_APP,"Temporary addressmap ('%s' to '%s') not performed, " "since it's already mapped to '%s'", - safe_str_client(address), - safe_str_client(new_address), - safe_str_client(ent->new_address)); + safe_str_client(address), + safe_str_client(new_address), + safe_str_client(ent->new_address)); tor_free(new_address); return; }