From 17df196bbcdb70414383343cf3dc73442e00f256 Mon Sep 17 00:00:00 2001 From: venaas Date: Thu, 5 Jun 2008 09:11:23 +0000 Subject: removing more state, also had forgotten to detach clientwr thread git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@285 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- radsecproxy.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/radsecproxy.c b/radsecproxy.c index 3a74491..f5b420b 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -2440,7 +2440,7 @@ void *clientwr(void *arg) { freeclsrvconf(conf); } freeserver(server, 1); - pthread_exit(NULL); + return NULL; } void *udpserverwr(void *arg) { @@ -2942,7 +2942,7 @@ void adddynamicrealmserver(struct realm *realm, struct clsrvconf *conf, char *id struct clsrvconf *srvconf; struct realm *newrealm = NULL; char *realmname, *s; - + pthread_t clientth; if (!conf->dynamiclookupcommand) return; @@ -2993,17 +2993,21 @@ void adddynamicrealmserver(struct realm *realm, struct clsrvconf *conf, char *id srvconf->servers->dynamiclookuparg = stringcopy(realmname, 0); - if (pthread_create(&srvconf->servers->clientth, NULL, clientwr, (void *)(srvconf->servers))) { + if (pthread_create(&clientth, NULL, clientwr, (void *)(srvconf->servers))) { debug(DBG_ERR, "pthread_create failed"); goto errexit; } - + pthread_detach(clientth); goto exit; errexit: if (newrealm) { list_removedata(realm->subrealms, newrealm); freerealm(newrealm); + if (!list_first(realm->subrealms)) { + list_destroy(realm->subrealms); + realm->subrealms = NULL; + } } freeserver(srvconf->servers, 1); free(srvconf); -- cgit v1.1