summaryrefslogtreecommitdiff
path: root/src/or/transports.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-11 13:44:10 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-16 15:02:51 -0500
commitedcc9981d8b8894d2ef4e0d617a20d7d99547817 (patch)
tree44476ecc42282d66930fb659d27fc9ad3c5a74b6 /src/or/transports.c
parent9c6d913b9e1b84ffcefb2cbd9cfe6f7bd15fc9b3 (diff)
downloadtor-edcc9981d8b8894d2ef4e0d617a20d7d99547817.tar.gz
tor-edcc9981d8b8894d2ef4e0d617a20d7d99547817.zip
Try to use smartlist_add_asprintf consistently
(To ensure correctness, in every case, make sure that the temporary variable is deleted, renamed, or lowered in scope, so we can't have any bugs related to accidentally relying on the no-longer-filled variable.)
Diffstat (limited to 'src/or/transports.c')
-rw-r--r--src/or/transports.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/or/transports.c b/src/or/transports.c
index abf9d884f7..d8d2ff6aa6 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -918,7 +918,7 @@ parse_cmethod_line(const char *line, managed_proxy_t *mp)
static char *
get_bindaddr_for_proxy(const managed_proxy_t *mp)
{
- char *bindaddr = NULL;
+ char *bindaddr_result = NULL;
char *bindaddr_tmp = NULL;
smartlist_t *string_tmp = smartlist_create();
@@ -927,18 +927,17 @@ get_bindaddr_for_proxy(const managed_proxy_t *mp)
SMARTLIST_FOREACH_BEGIN(mp->transports_to_launch, char *, t) {
bindaddr_tmp = get_bindaddr_for_transport(t);
- tor_asprintf(&bindaddr, "%s-%s", t, bindaddr_tmp);
- smartlist_add(string_tmp, bindaddr);
+ smartlist_add_asprintf(string_tmp, "%s-%s", t, bindaddr_tmp);
tor_free(bindaddr_tmp);
} SMARTLIST_FOREACH_END(t);
- bindaddr = smartlist_join_strings(string_tmp, ",", 0, NULL);
+ bindaddr_result = smartlist_join_strings(string_tmp, ",", 0, NULL);
SMARTLIST_FOREACH(string_tmp, char *, t, tor_free(t));
smartlist_free(string_tmp);
- return bindaddr;
+ return bindaddr_result;
}
#ifdef MS_WINDOWS