From a64b03a4fd2b7b146f4d5f8985229c7bd56d8721 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 5 Feb 2005 23:55:21 +0000 Subject: Avoid double-free on tor-resolve failure svn:r3567 --- src/or/connection_edge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index e67be3dfcf..75717c337b 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -906,8 +906,10 @@ int connection_exit_begin_resolve(cell_t *cell, circuit_t *circ) { /* send it off to the gethostbyname farm */ switch (dns_resolve(dummy_conn)) { - case 1: /* The result was cached; a resolved cell was sent. */ case -1: /* Impossible to resolve; a resolved cell was sent. */ + /* Connection freed; don't touch it. */ + return 0; + case 1: /* The result was cached; a resolved cell was sent. */ connection_free(dummy_conn); return 0; case 0: /* resolve added to pending list */ -- cgit v1.2.3-54-g00ecf