From 58dc2b3ab4c8dccde97632d1a2d27ba8e6b9c52a Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 1 Mar 2011 01:00:47 +0100 Subject: Don't have the connection freeing peers -- it's the contexts responsibility. Also, let _rs_peer_destroy() free secret. --- lib/conn.c | 10 +--------- lib/radsec.c | 2 ++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/conn.c b/lib/conn.c index 3fb6a97..924c225 100644 --- a/lib/conn.c +++ b/lib/conn.c @@ -123,7 +123,6 @@ rs_conn_disconnect (struct rs_connection *conn) int rs_conn_destroy (struct rs_connection *conn) { - struct rs_peer *p; int err = 0; assert (conn); @@ -136,14 +135,7 @@ rs_conn_destroy (struct rs_connection *conn) } /* NOTE: conn->realm is owned by context. */ - - for (p = conn->peers; p; p = p->next) - { - if (p->addr) - evutil_freeaddrinfo (p->addr); - if (p->secret) - rs_free (conn->ctx, p->secret); - } + /* NOTE: conn->peers is owned by context. */ if (conn->tev) event_free (conn->tev); diff --git a/lib/radsec.c b/lib/radsec.c index b9c9e35..3772158 100644 --- a/lib/radsec.c +++ b/lib/radsec.c @@ -120,6 +120,8 @@ _rs_peer_destroy (struct rs_peer *p) evutil_freeaddrinfo (p->addr); p->addr = NULL; } + if (p->secret) + rs_free (p->conn->ctx, p->secret); rs_free (p->conn->ctx, p); } -- cgit v1.1