diff options
author | Linus Nordberg <linus@nordu.net> | 2016-04-18 15:02:38 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-04-18 15:02:38 +0200 |
commit | b8aa87c056a3e0fc1771bd4145bbbf1be1fca4da (patch) | |
tree | 8ff6558c8960856b5f10404a01ec5460df5e32b1 /tcp.c | |
parent | b159585bb9057bc441fd44ecf2d97b3f80782927 (diff) |
Stomp less on other threads memory.stompless
See RADSECPROXY-64.
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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 |