aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-11 14:02:59 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-16 15:03:13 -0500
commitcc02823d7f6acbc3fa8ea87e5646921100796f10 (patch)
tree45d4ba4a4cc9ef73c076f08934f68d9690b9044c /src/or/router.c
parentedcc9981d8b8894d2ef4e0d617a20d7d99547817 (diff)
downloadtor-cc02823d7f6acbc3fa8ea87e5646921100796f10.tar
tor-cc02823d7f6acbc3fa8ea87e5646921100796f10.tar.gz
Convert instances of tor_snprintf+strdup into tor_asprintf
These were found by looking for tor_snprintf() instances that were followed closely by tor_strdup(), though I probably converted some other snprintfs as well.
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 7d9d2724f..f8aa1e3b0 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1973,11 +1973,8 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
format_iso_time(published, router->cache_info.published_on);
if (router->declared_family && smartlist_len(router->declared_family)) {
- size_t n;
- char *family = smartlist_join_strings(router->declared_family, " ", 0, &n);
- n += strlen("family ") + 2; /* 1 for \n, 1 for \0. */
- family_line = tor_malloc(n);
- tor_snprintf(family_line, n, "family %s\n", family);
+ char *family = smartlist_join_strings(router->declared_family, " ", 0, NULL);
+ tor_asprintf(&family_line, "family %s\n", family);
tor_free(family);
} else {
family_line = tor_strdup("");