projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
curl plugin: correct error message
[collectd.git]
/
src
/
memcached.c
diff --git
a/src/memcached.c
b/src/memcached.c
index
2c01a57
..
54e3a19
100644
(file)
--- a/
src/memcached.c
+++ b/
src/memcached.c
@@
-52,8
+52,9
@@
typedef struct memcached_s memcached_t;
static _Bool memcached_have_instances = 0;
static _Bool memcached_have_instances = 0;
-static void memcached_free (
memcached_t *st
)
+static void memcached_free (
void *arg
)
{
{
+ memcached_t *st = arg;
if (st == NULL)
return;
if (st == NULL)
return;
@@
-173,8
+174,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);
@@
-557,7
+557,7
@@
static int memcached_add_read_callback (memcached_t *st)
memset (&ud, 0, sizeof (ud));
ud.data = st;
memset (&ud, 0, sizeof (ud));
ud.data = st;
- ud.free_func =
(void *)
memcached_free;
+ ud.free_func = memcached_free;
assert (st->name != NULL);
ssnprintf (callback_name, sizeof (callback_name), "memcached/%s", st->name);
assert (st->name != NULL);
ssnprintf (callback_name, sizeof (callback_name), "memcached/%s", st->name);
@@
-587,14
+587,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
+684,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;