**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "configfile.h"
char *buffer = NULL;
size_t buffer_size = 0;
- struct sockaddr_un sa_unix;
+ struct sockaddr_un sa_unix = { 0 };
struct timeval stv_timeout;
cdtime_t cdt_timeout;
return (-1);
}
- memset (&sa_unix, 0, sizeof (sa_unix));
sa_unix.sun_family = AF_UNIX;
sstrncpy (sa_unix.sun_path,
(local_sockpath != NULL) ? local_sockpath : PDNS_LOCAL_SOCKPATH,
return (-1);
assert (buffer_size > 0);
- buffer = (char *) malloc (buffer_size);
+ buffer = malloc (buffer_size);
if (buffer == NULL)
{
FUNC_ERROR ("malloc");
else if (status == 0)
break;
- buffer_new = (char *) realloc (buffer, buffer_size + status + 1);
+ buffer_new = realloc (buffer, buffer_size + status + 1);
if (buffer_new == NULL)
{
FUNC_ERROR ("realloc");
return (-1);
}
- temp = (char **) realloc (li->fields,
+ temp = realloc (li->fields,
sizeof (char *) * (li->fields_num + ci->values_num));
if (temp == NULL)
{
return (-1);
}
- item = (list_item_t *) malloc (sizeof (list_item_t));
+ item = calloc (1, sizeof (*item));
if (item == NULL)
{
- ERROR ("powerdns plugin: malloc failed.");
+ ERROR ("powerdns plugin: calloc failed.");
return (-1);
}
- memset (item, '\0', sizeof (list_item_t));
item->instance = strdup (ci->values[0].value.string);
if (item->instance == NULL)