[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Replace a nasty add-malloc-snprintf with a nice clean asprintf
commit f2871009346e0589455be14e9cef930c19082c0a
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Sun May 15 11:41:49 2011 -0400
Replace a nasty add-malloc-snprintf with a nice clean asprintf
---
src/or/circuituse.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 86db7c3..7289aa5 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -1513,8 +1513,7 @@ static void
consider_recording_trackhost(edge_connection_t *conn, origin_circuit_t *circ)
{
or_options_t *options = get_options();
- size_t len;
- char *new_address;
+ char *new_address = NULL;
char fp[HEX_DIGEST_LEN+1];
/* Search the addressmap for this conn's destination. */
@@ -1534,12 +1533,7 @@ consider_recording_trackhost(edge_connection_t *conn, origin_circuit_t *circ)
circ->build_state->chosen_exit->identity_digest, DIGEST_LEN);
/* Add this exit/hostname pair to the addressmap. */
- len = strlen(conn->socks_request->address) + 1 /* '.' */ +
- strlen(fp) + 1 /* '.' */ +
- strlen("exit") + 1 /* '\0' */;
- new_address = tor_malloc(len);
-
- tor_snprintf(new_address, len, "%s.%s.exit",
+ tor_asprintf(&new_address, "%s.%s.exit",
conn->socks_request->address, fp);
addressmap_register(conn->socks_request->address, new_address,
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits