Merge pull request #1743 from rubenk/apcups-coverity
[collectd.git] / src / email.c
index 8898c08..8a1ac2e 100644 (file)
 
 #include <stddef.h>
 
-#if HAVE_LIBPTHREAD
-# include <pthread.h>
-#endif
-
 #include <sys/un.h>
 #include <sys/select.h>
 
@@ -537,13 +533,12 @@ static void *open_connection (void __attribute__((unused)) *arg)
                        break;
                }
 
-               connection = malloc (sizeof (*connection));
+               connection = calloc (1, sizeof (*connection));
                if (connection == NULL)
                {
                        close (remote);
                        continue;
                }
-               memset (connection, 0, sizeof (*connection));
 
                connection->socket = fdopen (remote, "r");
                connection->next   = NULL;