aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/crypt_path.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-04-26 14:26:22 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-05-03 18:15:26 +0300
commit4060b7623d3845a4d4ecdbf8f9c219e0148e1380 (patch)
treee7debcebc3f604ecdd7d010bcaa7d59bca218c6e /src/core/or/crypt_path.c
parent2e9e3e7d4198ff75e6bd12bc7a38c0f288fbe381 (diff)
downloadtor-4060b7623d3845a4d4ecdbf8f9c219e0148e1380.tar.gz
tor-4060b7623d3845a4d4ecdbf8f9c219e0148e1380.zip
Revert "Hiding crypt_path_t: Create a constructor for crypt_path_t."
This reverts commit ab8b80944967ee5a6a0c45dbf61839cf257bfe44.
Diffstat (limited to 'src/core/or/crypt_path.c')
-rw-r--r--src/core/or/crypt_path.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/core/or/crypt_path.c b/src/core/or/crypt_path.c
index c7ff8690de..c44d65231d 100644
--- a/src/core/or/crypt_path.c
+++ b/src/core/or/crypt_path.c
@@ -37,17 +37,6 @@
#include "core/or/crypt_path_st.h"
#include "core/or/cell_st.h"
-/** Initialize and return a minimal crypt_path_t */
-crypt_path_t *
-crypt_path_new(void)
-{
- crypt_path_t *cpath = tor_malloc_zero(sizeof(crypt_path_t));
- cpath->magic = CRYPT_PATH_MAGIC;
- cpath->private = tor_malloc_zero(sizeof(struct crypt_path_private_t));
-
- return cpath;
-}
-
/** Add <b>new_hop</b> to the end of the doubly-linked-list <b>head_ptr</b>.
* This function is used to extend cpath by another hop.
*/
@@ -71,11 +60,12 @@ cpath_extend_linked_list(crypt_path_t **head_ptr, crypt_path_t *new_hop)
int
cpath_append_hop(crypt_path_t **head_ptr, extend_info_t *choice)
{
- crypt_path_t *hop = crypt_path_new();
+ crypt_path_t *hop = tor_malloc_zero(sizeof(crypt_path_t));
/* link hop into the cpath, at the end. */
cpath_extend_linked_list(head_ptr, hop);
+ hop->magic = CRYPT_PATH_MAGIC;
hop->state = CPATH_STATE_CLOSED;
hop->extend_info = extend_info_dup(choice);
@@ -180,7 +170,6 @@ cpath_free(crypt_path_t *victim)
onion_handshake_state_release(&victim->handshake_state);
crypto_dh_free(victim->rend_dh_handshake_state);
extend_info_free(victim->extend_info);
- tor_free(victim->private);
memwipe(victim, 0xBB, sizeof(crypt_path_t)); /* poison memory */
tor_free(victim);