summaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorRobert Ransom <rransom.8774@gmail.com>2012-01-06 22:44:20 -0800
committerRobert Ransom <rransom.8774@gmail.com>2012-01-06 22:44:20 -0800
commitb46a7ebb2bf2cae94a9ce4447c55014dd90ad868 (patch)
tree3461f5d0b32be416e045b16b2c20fbeb80c8f776 /src/or/circuitlist.c
parent37c90319e2ac0ecb71c9986ff55d07fe3da86ee6 (diff)
downloadtor-b46a7ebb2bf2cae94a9ce4447c55014dd90ad868.tar.gz
tor-b46a7ebb2bf2cae94a9ce4447c55014dd90ad868.zip
Don't remove rend cpath element from relaunched service-side rend circs
Fixes bug 4842, not in any release.
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 97b6162606..319acdb0d6 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -39,6 +39,7 @@ static smartlist_t *circuits_pending_or_conns=NULL;
static void circuit_free(circuit_t *circ);
static void circuit_free_cpath(crypt_path_t *cpath);
static void circuit_free_cpath_node(crypt_path_t *victim);
+static void cpath_ref_decref(crypt_path_reference_t *cpath_ref);
/********* END VARIABLES ************/
@@ -600,6 +601,7 @@ circuit_free(circuit_t *circ)
if (ocirc->build_state) {
extend_info_free(ocirc->build_state->chosen_exit);
circuit_free_cpath_node(ocirc->build_state->pending_final_cpath);
+ cpath_ref_decref(ocirc->build_state->service_pending_final_cpath_ref);
}
tor_free(ocirc->build_state);
@@ -723,6 +725,18 @@ circuit_free_cpath_node(crypt_path_t *victim)
tor_free(victim);
}
+/** Release a crypt_path_reference_t*, which may be NULL. */
+static void
+cpath_ref_decref(crypt_path_reference_t *cpath_ref)
+{
+ if (cpath_ref != NULL) {
+ if (--(cpath_ref->refcount) == 0) {
+ circuit_free_cpath_node(cpath_ref->cpath);
+ tor_free(cpath_ref);
+ }
+ }
+}
+
/** A helper function for circuit_dump_by_conn() below. Log a bunch
* of information about circuit <b>circ</b>.
*/