netcmd plugin: Free the pthread attr structure.
authorFlorian Forster <octo@collectd.org>
Wed, 12 Sep 2012 16:10:04 +0000 (18:10 +0200)
committerFlorian Forster <octo@collectd.org>
Tue, 9 Jun 2015 16:52:10 +0000 (17:52 +0100)
src/netcmd.c

index 486dbc8..1d1e41b 100644 (file)
@@ -1146,8 +1146,8 @@ static void *nc_server_thread (void __attribute__((unused)) *arg) /* {{{ */
       pthread_attr_init (&th_attr);
       pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
 
       pthread_attr_init (&th_attr);
       pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
 
-      status = pthread_create (&th, &th_attr, nc_handle_client,
-          conn);
+      status = pthread_create (&th, &th_attr, nc_handle_client, conn);
+      pthread_attr_destroy (&th_attr);
       if (status != 0)
       {
         WARNING ("netcmd plugin: pthread_create failed: %s",
       if (status != 0)
       {
         WARNING ("netcmd plugin: pthread_create failed: %s",