projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
all plugins: remove pthread.h include
[collectd.git]
/
src
/
memcached.c
diff --git
a/src/memcached.c
b/src/memcached.c
index
2c01a57
..
62ac72a
100644
(file)
--- a/
src/memcached.c
+++ b/
src/memcached.c
@@
-173,8
+173,7
@@
static int memcached_connect (memcached_t *st)
static int memcached_query_daemon (char *buffer, size_t buffer_size, memcached_t *st)
{
static int memcached_query_daemon (char *buffer, size_t buffer_size, memcached_t *st)
{
- int fd = -1;
- int status;
+ int fd, status;
size_t buffer_fill;
fd = memcached_connect (st);
size_t buffer_fill;
fd = memcached_connect (st);
@@
-587,14
+586,13
@@
static int config_add_instance(oconfig_item_t *ci)
/* Disable automatic generation of default instance in the init callback. */
memcached_have_instances = 1;
/* Disable automatic generation of default instance in the init callback. */
memcached_have_instances = 1;
- st =
malloc (
sizeof (*st));
+ st =
calloc (1,
sizeof (*st));
if (st == NULL)
{
if (st == NULL)
{
- ERROR ("memcached plugin:
m
alloc failed.");
+ ERROR ("memcached plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (st, 0, sizeof (*st));
st->name = NULL;
st->socket = NULL;
st->host = NULL;
st->name = NULL;
st->socket = NULL;
st->host = NULL;
@@
-685,10
+683,9
@@
static int memcached_init (void)
return (0);
/* No instances were configured, lets start a default instance. */
return (0);
/* No instances were configured, lets start a default instance. */
- st =
malloc (
sizeof (*st));
+ st =
calloc (1,
sizeof (*st));
if (st == NULL)
return (ENOMEM);
if (st == NULL)
return (ENOMEM);
- memset (st, 0, sizeof (*st));
st->name = sstrdup ("__legacy__");
st->socket = NULL;
st->host = NULL;
st->name = sstrdup ("__legacy__");
st->socket = NULL;
st->host = NULL;