strdup the intro point when you pick it, so you

don't free it and then return it


svn:r1483
This commit is contained in:
Roger Dingledine 2004-04-05 17:56:34 +00:00
parent ac84512489
commit 92bb5b2860
2 changed files with 5 additions and 2 deletions

View 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)) {

View 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,