diff options
author | Linus Nordberg <linus@nordu.net> | 2016-04-18 15:02:38 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-09-21 12:17:52 +0200 |
commit | 5acfcb4c7ce94482660dedb710e0b1f2ab8e5578 (patch) | |
tree | 92624c1abeb9274fc14e1174a6eb86cddce9f9b9 /tcp.c | |
parent | 6c1f37d727afb31ac3fa4af4a4158993897d402d (diff) |
Stomp less on other threads memory.
See RADSECPROXY-64.
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -344,19 +344,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); @@ -364,7 +364,6 @@ void *tcplistener(void *arg) { } pthread_detach(tcpserverth); } - free(sp); return NULL; } #else |