summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dd5fc7c)
raw | patch | inline | side by side (parent: dd5fc7c)
author | Gerrie Roos <groos@xiplink.com> | |
Fri, 25 May 2012 03:38:47 +0000 (05:38 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 11 Sep 2012 07:04:14 +0000 (09:04 +0200) |
Once I understood what's going on I tried to keep the changes to a minimum.
Signed-off-by: Florian Forster <octo@collectd.org>
Signed-off-by: Florian Forster <octo@collectd.org>
src/collectd.c | patch | blob | history | |
src/exec.c | patch | blob | history | |
src/meta_data.c | patch | blob | history | |
src/unixsock.c | patch | blob | history | |
src/utils_fbhash.c | patch | blob | history |
diff --git a/src/collectd.c b/src/collectd.c
index b68aea5ca9ce894b5b7d7c13289726e3bc11a4d9..6b77d59908233f260b5d1903e38380dbb79d2680 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
pthread_create (&thread, &attr, do_flush, NULL);
+ pthread_attr_destroy (&attr);
}
static int init_hostname (void)
diff --git a/src/exec.c b/src/exec.c
index 34c88a1ce6eb65e801bed579da1ea57e72a2e8b7..dd295e98a323cd806f1072ad814e7bb47af8fee3 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
pthread_create (&t, &attr, exec_read_one, (void *) pl);
+ pthread_attr_destroy (&attr);
} /* for (pl) */
return (0);
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
pthread_create (&t, &attr, exec_notification_one, (void *) pln);
+ pthread_attr_destroy (&attr);
} /* for (pl) */
return (0);
diff --git a/src/meta_data.c b/src/meta_data.c
index b502b377295141a8a095ba248d7e6de0ab285072..ea98ba94abf44670583ab47601e39ce6a0f68394 100644 (file)
--- a/src/meta_data.c
+++ b/src/meta_data.c
if (md == NULL)
return;
+ pthread_mutex_destroy(&md->lock);
md_entry_free (md->head);
pthread_mutex_destroy (&md->lock);
free (md);
diff --git a/src/unixsock.c b/src/unixsock.c
index 0b897482c9d956547d74be3f905f9d9941b157be..344424715e6e0cc23c938c38a17b280686a19168 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
close (fdin);
close (fdout);
pthread_exit ((void *) 1);
+ return ((void *) 1);
}
fhout = fdopen (fdout, "w");
fclose (fhin); /* this closes fdin as well */
close (fdout);
pthread_exit ((void *) 1);
+ return ((void *) 1);
}
/* change output buffer to line buffered mode */
fclose (fhin);
fclose (fhout);
pthread_exit ((void *) 1);
+ return ((void *) 0);
}
while (42)
fclose (fhin);
fclose (fhout);
pthread_exit ((void *) 1);
+ return ((void *) 1);
}
if (strcasecmp (fields[0], "getval") == 0)
pthread_t th;
pthread_attr_t th_attr;
+ pthread_attr_init (&th_attr);
+ pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
+
if (us_open_socket () != 0)
pthread_exit ((void *) 1);
sstrerror (errno, errbuf, sizeof (errbuf)));
close (sock_fd);
sock_fd = -1;
+ pthread_attr_destroy (&th_attr);
pthread_exit ((void *) 1);
}
DEBUG ("Spawning child to handle connection on fd #%i", *remote_fd);
- pthread_attr_init (&th_attr);
- pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
-
status = pthread_create (&th, &th_attr, us_handle_client, (void *) remote_fd);
if (status != 0)
{
close (sock_fd);
sock_fd = -1;
+ pthread_attr_destroy (&th_attr);
status = unlink ((sock_file != NULL) ? sock_file : US_DEFAULT_PATH);
if (status != 0)
diff --git a/src/utils_fbhash.c b/src/utils_fbhash.c
index d20b7e39bdd453de1bdec5c4564ed30e994647a6..97f21a1f78317ebc4cc5d8ccce7f61dcd322b0ae 100644 (file)
--- a/src/utils_fbhash.c
+++ b/src/utils_fbhash.c
if (h == NULL)
return;
+ pthread_mutex_destroy (&h->lock);
free (h->filename);
fbh_free_tree (h->tree);
} /* }}} void fbh_destroy */