filecount plugin: malloc + memset -> calloc
[collectd.git] / src / teamspeak2.c
index 56e8d14..345f57e 100644 (file)
@@ -83,7 +83,7 @@ static int tss2_add_vserver (int vserver_port)
        }
 
        /* Allocate memory */
-       entry = (vserver_list_t *) malloc (sizeof (vserver_list_t));
+       entry = malloc (sizeof (*entry));
        if (entry == NULL)
        {
                ERROR ("teamspeak2 plugin: malloc failed.");
@@ -257,6 +257,7 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh)
                        WARNING ("teamspeak2 plugin: connect failed: %s",
                                        sstrerror (errno, errbuf, sizeof (errbuf)));
                        close (sd);
+                       sd = -1;
                        continue;
                }