]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
strdup the intro point when you pick it, so you
authorRoger Dingledine <arma@torproject.org>
Mon, 5 Apr 2004 17:56:34 +0000 (17:56 +0000)
committerRoger Dingledine <arma@torproject.org>
Mon, 5 Apr 2004 17:56:34 +0000 (17:56 +0000)
don't free it and then return it

svn:r1483

src/or/connection_edge.c
src/or/rendclient.c

index cf61be1e9b569bc8331e79470097ebd2b08eedb4..61d60271fe0932312c45229f17c4b4030c495585 100644 (file)
@@ -796,6 +796,7 @@ circuit_get_open_circ_or_launch(connection_t *conn,
       new_circ_purpose = desired_circuit_purpose;
 
     circ = circuit_launch_new(new_circ_purpose, exitname);
+    tor_free(exitname);
 
     if(circ &&
        (desired_circuit_purpose != CIRCUIT_PURPOSE_C_GENERAL)) {
index 96ea145cae9069da4877185d749ef55505a5f545..e894cef5f45b1f2988dd214ea9a2588275da56c7 100644 (file)
@@ -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,