summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index d4b6578..1590e65 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -1990,7 +1990,7 @@ errexit:
void createlistener(uint8_t type, char *arg) {
pthread_t th;
struct addrinfo *res;
- int s = -1, on = 1;
+ int s = -1, on = 1, *sp = NULL;
struct hostportres *hp = newhostport(arg, protodefs[type]->portdefault, 0);
if (!hp || !resolvehostport(hp, AF_UNSPEC, protodefs[type]->socktype, 1))
@@ -2017,10 +2017,16 @@ void createlistener(uint8_t type, char *arg) {
continue;
}
- if (pthread_create(&th, &pthread_attr, protodefs[type]->listener, (void *)s))
+ sp = malloc(sizeof(int));
+ if (!sp)
+ debugx(1, DBG_ERR, "malloc failed");
+ *sp = s;
+ if (pthread_create(&th, &pthread_attr, protodefs[type]->listener, (void *)sp))
debugerrnox(errno, DBG_ERR, "pthread_create failed");
pthread_detach(th);
}
+ if (!sp)
+ debugx(1, DBG_ERR, "createlistener: socket/bind failed");
debug(DBG_WARN, "createlistener: listening for %s on %s:%s", protodefs[type]->name, hp->host ? hp->host : "*", hp->port);
freehostport(hp);