Browse Source

r17989@catbus: nickm | 2008-02-08 18:09:23 -0500
Fix a new segfault when poisoning a non-present socks request.


svn:r13433

Nick Mathewson 17 years ago
parent
commit
272d37deb3
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/or/connection.c

+ 4 - 2
src/or/connection.c

@@ -337,8 +337,10 @@ _connection_free(connection_t *conn)
   if (CONN_IS_EDGE(conn)) {
   if (CONN_IS_EDGE(conn)) {
     edge_connection_t *edge_conn = TO_EDGE_CONN(conn);
     edge_connection_t *edge_conn = TO_EDGE_CONN(conn);
     tor_free(edge_conn->chosen_exit_name);
     tor_free(edge_conn->chosen_exit_name);
-    memset(edge_conn->socks_request, 0xcc, sizeof(socks_request_t));
-    tor_free(edge_conn->socks_request);
+    if (edge_conn->socks_request) {
+      memset(edge_conn->socks_request, 0xcc, sizeof(socks_request_t));
+      tor_free(edge_conn->socks_request);
+    }
   }
   }
   if (conn->type == CONN_TYPE_CONTROL) {
   if (conn->type == CONN_TYPE_CONTROL) {
     control_connection_t *control_conn = TO_CONTROL_CONN(conn);
     control_connection_t *control_conn = TO_CONTROL_CONN(conn);