aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendclient.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-05 17:56:34 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-05 17:56:34 +0000
commit92bb5b2860622795d24f9c2945868762a66e9a1e (patch)
treeb2a77e8e235f36b7ab16b75a5d0e3695ce48246b /src/or/rendclient.c
parentac84512489404f4d0cecec7353b1cc1dae1d2c69 (diff)
downloadtor-92bb5b2860622795d24f9c2945868762a66e9a1e.tar.gz
tor-92bb5b2860622795d24f9c2945868762a66e9a1e.zip
strdup the intro point when you pick it, so you
don't free it and then return it svn:r1483
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r--src/or/rendclient.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 96ea145cae..e894cef5f4 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -205,7 +205,7 @@ int rend_cmp_service_ids(char *one, char *two) {
return strcasecmp(one,two);
}
-/* return a pointer to a nickname for a random introduction
+/* strdup a nickname for a random introduction
* point of query. return NULL if error.
*/
char *rend_client_get_random_intro(char *query) {
@@ -215,6 +215,7 @@ char *rend_client_get_random_intro(char *query) {
smartlist_t *sl;
rend_service_descriptor_t *parsed;
char *choice;
+ char *nickname;
if(rend_cache_lookup(query, &descp, &desc_len) < 1) {
log_fn(LOG_WARN,"query '%s' didn't have valid rend desc in cache. Failing.", query);
@@ -234,9 +235,10 @@ char *rend_client_get_random_intro(char *query) {
smartlist_add(sl,parsed->intro_points[i]);
choice = smartlist_choose(sl);
+ nickname = tor_strdup(choice);
smartlist_free(sl);
rend_service_descriptor_free(parsed);
- return choice;
+ return nickname;
}
/* If address is of the form "y.onion" with a well-formed handle y,