Code

teamspeak2: malloc + memset -> calloc
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:24:23 +0000 (18:24 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:24:23 +0000 (18:24 +0200)
src/teamspeak2.c

index 345f57e0d6a5c534fe57d3a946cd6555e95f9e72..263863b93c8a695e002191fa70cc306d70b30fbb 100644 (file)
@@ -83,13 +83,12 @@ static int tss2_add_vserver (int vserver_port)
        }
 
        /* Allocate memory */
-       entry = malloc (sizeof (*entry));
+       entry = calloc (1, sizeof (*entry));
        if (entry == NULL)
        {
-               ERROR ("teamspeak2 plugin: malloc failed.");
+               ERROR ("teamspeak2 plugin: calloc failed.");
                return (-1);
        }
-       memset (entry, 0, sizeof (vserver_list_t));
 
        /* Save data */
        entry->port = vserver_port;