From 3ae96845d33b11ded74d0e569a859d8f138b70d9 Mon Sep 17 00:00:00 2001
From: George Kadianakis <desnacked@gmail.com>
Date: Thu, 3 Nov 2011 17:16:31 +0100
Subject: [PATCH] Fix a memleak when fetching descriptors for bridges in
 ExcludeNodes.

---
 changes/bug4383       | 5 +++++
 src/or/circuitbuild.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 changes/bug4383

diff --git a/changes/bug4383 b/changes/bug4383
new file mode 100644
index 0000000000..e618b8c8fb
--- /dev/null
+++ b/changes/bug4383
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Fix a memleak in launch_direct_bridge_descriptor_fetch() that
+      occured when a client tried to fetch a descriptor for a bridge
+      in ExcludeNodes. Fixes #4383; bugfix on 0.2.2.25-alpha.
+
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index c864fd2497..72ec9e4880 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -4670,7 +4670,6 @@ launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge)
       DIR_PURPOSE_FETCH_SERVERDESC))
     return; /* it's already on the way */
 
-  address = tor_dup_addr(&bridge->addr);
   if (routerset_contains_bridge(options->ExcludeNodes, bridge)) {
     download_status_mark_impossible(&bridge->fetch_status);
     log_warn(LD_APP, "Not using bridge at %s: it is in ExcludeNodes.",
@@ -4678,6 +4677,8 @@ launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge)
     return;
   }
 
+  address = tor_dup_addr(&bridge->addr);
+
   directory_initiate_command(address, &bridge->addr,
                              bridge->port, 0,
                              0, /* does not matter */
-- 
GitLab