about summary refs log tree commit diff stats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index fc5835b..7114cc7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -279,12 +279,7 @@ int main(int argc, char **argv) {
 			}
 		}
 		//TODO: use std threads
-		pthread_t *_thread = malloc(sizeof(pthread_t));
-		if (_thread == NULL) {
-			syslog(LOG_CRIT, "unable to allocate memory: %s", strerror(errno));
-			free(args);
-			continue;
-		}
+		pthread_t _thread;
 		void *(*func)(void *);
 		switch (oc) {
 			case RRQ:
@@ -300,15 +295,12 @@ int main(int argc, char **argv) {
 		//TODO: use std threads
 		int e;
 		syslog(LOG_ERR, "spawning thread for %s", inet_ntoa(caddr.sin_addr));
-//		void *lol = func((void *)args);
-//		free(lol);
-		if ((e = pthread_create(_thread, 0, func, (void *)args)) != 0) {
+		if ((e = pthread_create(&_thread, 0, func, (void *)args)) != 0) {
 			syslog(
 				LOG_CRIT,
 				"unable to spawn thread: %s",
 				strerror(e)
 			);
-			free(_thread);
 			free(args);
 		}
 	}