diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/directory.c | 4 | ||||
-rw-r--r-- | src/or/hs_cache.c | 16 | ||||
-rw-r--r-- | src/or/hs_cache.h | 2 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index a3aa276df7..75fc103577 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -3400,7 +3400,7 @@ handle_get_hs_descriptor_v3(dir_connection_t *conn, const get_handler_args_t *args) { int retval; - char *desc_str = NULL; + const char *desc_str = NULL; const char *pubkey_str = NULL; const char *url = args->url; @@ -3434,8 +3434,6 @@ handle_get_hs_descriptor_v3(dir_connection_t *conn, connection_write_to_buf(desc_str, strlen(desc_str), TO_CONN(conn)); done: - tor_free(desc_str); - return 0; } diff --git a/src/or/hs_cache.c b/src/or/hs_cache.c index 6d33201469..ec98b47f84 100644 --- a/src/or/hs_cache.c +++ b/src/or/hs_cache.c @@ -142,13 +142,13 @@ cache_store_v3_as_dir(hs_cache_dir_descriptor_t *desc) return -1; } -/* Using the query which is the blinded key for a descriptor version 3, lookup - * in our directory cache the entry. If found, 1 is returned and desc_out is - * populated with a newly allocated string being the encoded descriptor. If - * not found, 0 is returned and desc_out is untouched. On error, a negative - * value is returned and desc_out is untouched. */ +/* Using the query which is the base64 encoded blinded key of a version 3 + * descriptor, lookup in our directory cache the entry. If found, 1 is + * returned and desc_out is populated with a newly allocated string being the + * encoded descriptor. If not found, 0 is returned and desc_out is untouched. + * On error, a negative value is returned and desc_out is untouched. */ static int -cache_lookup_v3_as_dir(const char *query, char **desc_out) +cache_lookup_v3_as_dir(const char *query, const char **desc_out) { int found = 0; ed25519_public_key_t blinded_key; @@ -167,7 +167,7 @@ cache_lookup_v3_as_dir(const char *query, char **desc_out) if (entry != NULL) { found = 1; if (desc_out) { - *desc_out = tor_strdup(entry->encoded_desc); + *desc_out = entry->encoded_desc; } } @@ -270,7 +270,7 @@ hs_cache_store_as_dir(const char *desc) * untouched. */ int hs_cache_lookup_as_dir(uint32_t version, const char *query, - char **desc_out) + const char **desc_out) { int found; diff --git a/src/or/hs_cache.h b/src/or/hs_cache.h index 466c33db09..88f84c1270 100644 --- a/src/or/hs_cache.h +++ b/src/or/hs_cache.h @@ -48,7 +48,7 @@ size_t hs_cache_handle_oom(time_t now, size_t min_remove_bytes); * right function. */ int hs_cache_store_as_dir(const char *desc); int hs_cache_lookup_as_dir(uint32_t version, const char *query, - char **desc_out); + const char **desc_out); #ifdef HS_CACHE_PRIVATE |