summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 079f57d)
raw | patch | inline | side by side (parent: 079f57d)
author | Florian Forster <octo@collectd.org> | |
Tue, 1 Dec 2015 10:27:13 +0000 (11:27 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 1 Dec 2015 10:27:54 +0000 (11:27 +0100) |
Fixes: #1110
src/daemon/plugin.c | patch | blob | history |
diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index 831e3fb0311398c5c1b75cddc67b5e5d4b2b8c0e..fe6cc2b3980e1bfad3583cceda7a2d9db1048079 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
{
ERROR ("plugin: register_callback: "
"llentry_create failed.");
- free (key);
+ sfree (key);
destroy_callback (cf);
return (-1);
}
*str = '\0';
strjoin(str, len, keys, n, "', '");
INFO("%s ['%s']", comment, str);
- free(str);
+ sfree (str);
}
- free(keys);
+ sfree (keys);
} /* }}} void log_list_callbacks */
static int create_register_callback (llist_t **list, /* {{{ */
*/
void plugin_set_dir (const char *dir)
{
- if (plugindir != NULL)
- free (plugindir);
+ sfree (plugindir);
if (dir == NULL)
- plugindir = NULL;
- else if ((plugindir = strdup (dir)) == NULL)
{
- char errbuf[1024];
- ERROR ("strdup failed: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
+ plugindir = NULL;
+ return;
}
+
+ plugindir = strdup (dir);
+ if (plugindir == NULL)
+ ERROR ("plugin_set_dir: strdup(\"%s\") failed", dir);
}
static _Bool plugin_is_loaded (char const *name)
if (cb == NULL) return;
- sfree(cb->name);
- sfree(cb);
+ sfree (cb->name);
+ sfree (cb);
} /* static void plugin_flush_callback_free */
static char *plugin_flush_callback_name (const char *name)
if (cb == NULL)
{
ERROR ("plugin_register_flush: malloc failed.");
- sfree(flush_name);
+ sfree (flush_name);
return (-1);
}
if (cb->name == NULL)
{
ERROR ("plugin_register_flush: strdup failed.");
- sfree(cb);
- sfree(flush_name);
+ sfree (cb);
+ sfree (flush_name);
return (-1);
}
cb->timeout = ctx.flush_timeout;
/* interval = */ ctx.flush_interval,
/* user data = */ &ud);
- sfree(flush_name);
+ sfree (flush_name);
if (status != 0)
{
- sfree(cb->name);
- sfree(cb);
+ sfree (cb->name);
+ sfree (cb);
return status;
}
}
* ds->ds_num);
if (ds_copy->ds == NULL)
{
- free (ds_copy);
+ sfree (ds_copy);
return (-1);
}
if (flush_name != NULL)
{
plugin_unregister_read(flush_name);
- sfree(flush_name);
+ sfree (flush_name);
}
}
* don't get confused.. */
if (saved_values != NULL)
{
- free (vl->values);
+ sfree (vl->values);
vl->values = saved_values;
vl->values_len = saved_values_len;
}
* confused.. */
if (saved_values != NULL)
{
- free (vl->values);
+ sfree (vl->values);
vl->values = saved_values;
vl->values_len = saved_values_len;
}
if (this->type == NM_TYPE_STRING)
{
- free ((char *)this->nm_value.nm_string);
+ /* Assign to a temporary variable to work around nm_string's const
+ * modifier. */
+ void *tmp = (void *) this->nm_value.nm_string;
+
+ sfree (tmp);
this->nm_value.nm_string = NULL;
}
sfree (this);
plugin_set_ctx (plugin_thread->ctx);
- free (plugin_thread);
+ sfree (plugin_thread);
return start_routine (plugin_arg);
} /* void *plugin_thread_start */