summaryrefslogtreecommitdiff
path: root/lib/radsec.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-03-12 01:03:43 +0100
committerLinus Nordberg <linus@nordu.net>2011-03-12 01:03:43 +0100
commitefce8db03af505f76c0c579f2439757bd6998dc9 (patch)
tree7c3f33df5316fd67431fc4e70356d7a62da4543f /lib/radsec.c
parentc19e71100032927bf5d88ef700a5034dc3f08565 (diff)
Fix crash bug in _rs_peer_destroy().udp
Don't expect a peer to always have a connection.
Diffstat (limited to 'lib/radsec.c')
-rw-r--r--lib/radsec.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/lib/radsec.c b/lib/radsec.c
index 0957365..a05a22b 100644
--- a/lib/radsec.c
+++ b/lib/radsec.c
@@ -131,23 +131,6 @@ rs_resolv (struct evutil_addrinfo **addr,
return NULL;
}
-static void
-_rs_peer_destroy (struct rs_peer *p)
-{
- assert (p);
- assert (p->conn);
- assert (p->conn->ctx);
-
- /* NOTE: The peer object doesn't own conn, nor realm. */
- /* NOTE: secret is owned by config */
- if (p->addr)
- {
- evutil_freeaddrinfo (p->addr);
- p->addr = NULL;
- }
- rs_free (p->conn->ctx, p);
-}
-
void
rs_context_destroy (struct rs_context *ctx)
{
@@ -160,8 +143,10 @@ rs_context_destroy (struct rs_context *ctx)
for (p = r->peers; p; )
{
struct rs_peer *tmp = p;
+ if (p->addr)
+ evutil_freeaddrinfo (p->addr);
p = p->next;
- _rs_peer_destroy (tmp);
+ rs_free (ctx, tmp);
}
rs_free (ctx, r->name);
r = r->next;