From b8aa87c056a3e0fc1771bd4145bbbf1be1fca4da Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 18 Apr 2016 15:02:38 +0200 Subject: Stomp less on other threads memory. See RADSECPROXY-64. --- tcp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tcp.c') diff --git a/tcp.c b/tcp.c index a2f8e7c..c47b153 100644 --- a/tcp.c +++ b/tcp.c @@ -345,19 +345,19 @@ exit: void *tcplistener(void *arg) { pthread_t tcpserverth; - int s, *sp = (int *)arg; + int s, listensock = (int) arg; struct sockaddr_storage from; socklen_t fromlen = sizeof(from); - listen(*sp, 0); + listen(listensock, 0); for (;;) { - s = accept(*sp, (struct sockaddr *)&from, &fromlen); + s = accept(listensock, (struct sockaddr *)&from, &fromlen); if (s < 0) { debug(DBG_WARN, "accept failed"); continue; } - if (pthread_create(&tcpserverth, &pthread_attr, tcpservernew, (void *)&s)) { + if (pthread_create(&tcpserverth, &pthread_attr, tcpservernew, (void *) s)) { debug(DBG_ERR, "tcplistener: pthread_create failed"); shutdown(s, SHUT_RDWR); close(s); @@ -365,7 +365,6 @@ void *tcplistener(void *arg) { } pthread_detach(tcpserverth); } - free(sp); return NULL; } #else -- cgit v1.1