[or-cvs] strdup the intro point when you pick it, so you

Roger Dingledine arma at seul.org
Mon Apr 5 17:56:36 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	connection_edge.c rendclient.c 
Log Message:
strdup the intro point when you pick it, so you
don't free it and then return it


Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- connection_edge.c	5 Apr 2004 17:50:59 -0000	1.139
+++ connection_edge.c	5 Apr 2004 17:56:34 -0000	1.140
@@ -796,6 +796,7 @@
       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: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- rendclient.c	5 Apr 2004 17:51:00 -0000	1.11
+++ rendclient.c	5 Apr 2004 17:56:34 -0000	1.12
@@ -205,7 +205,7 @@
   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 @@
   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 @@
     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,



More information about the tor-commits mailing list