projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3339 from jkohen/patch-1
[collectd.git]
/
src
/
amqp1.c
diff --git
a/src/amqp1.c
b/src/amqp1.c
index
a7fd26b
..
4325f00
100644
(file)
--- a/
src/amqp1.c
+++ b/
src/amqp1.c
@@
-572,8
+572,10
@@
static int amqp1_config_instance(oconfig_item_t *ci) /* {{{ */
else if (strcasecmp("Format", child->key) == 0) {
char *key = NULL;
status = cf_util_get_string(child, &key);
else if (strcasecmp("Format", child->key) == 0) {
char *key = NULL;
status = cf_util_get_string(child, &key);
- if (status != 0)
+ if (status != 0) {
+ amqp1_config_instance_free(instance);
return status;
return status;
+ }
assert(key != NULL);
if (strcasecmp(key, "Command") == 0) {
instance->format = AMQP1_FORMAT_COMMAND;
assert(key != NULL);
if (strcasecmp(key, "Command") == 0) {
instance->format = AMQP1_FORMAT_COMMAND;
@@
-624,29
+626,33
@@
static int amqp1_config_instance(oconfig_item_t *ci) /* {{{ */
return status;
} else {
char tpname[DATA_MAX_NAME_LEN];
return status;
} else {
char tpname[DATA_MAX_NAME_LEN];
- status = snprintf(tpname, sizeof(tpname), "amqp1/%s", instance->name);
+ status = s
s
nprintf(tpname, sizeof(tpname), "amqp1/%s", instance->name);
if ((status < 0) || (size_t)status >= sizeof(tpname)) {
ERROR("amqp1 plugin: Instance name would have been truncated.");
if ((status < 0) || (size_t)status >= sizeof(tpname)) {
ERROR("amqp1 plugin: Instance name would have been truncated.");
+ amqp1_config_instance_free(instance);
return -1;
}
return -1;
}
- status = snprintf(instance->send_to, sizeof(instance->send_to), "/%s/%s",
- transport->address, instance->name);
+ status = s
s
nprintf(instance->send_to, sizeof(instance->send_to), "/%s/%s",
+
transport->address, instance->name);
if ((status < 0) || (size_t)status >= sizeof(instance->send_to)) {
ERROR("amqp1 plugin: send_to address would have been truncated.");
if ((status < 0) || (size_t)status >= sizeof(instance->send_to)) {
ERROR("amqp1 plugin: send_to address would have been truncated.");
+ amqp1_config_instance_free(instance);
return -1;
}
if (instance->notify) {
status = plugin_register_notification(
tpname, amqp1_notify,
&(user_data_t){
return -1;
}
if (instance->notify) {
status = plugin_register_notification(
tpname, amqp1_notify,
&(user_data_t){
- .data = instance, .free_func = amqp1_config_instance_free,
+ .data = instance,
+ .free_func = amqp1_config_instance_free,
});
} else {
});
} else {
- status = plugin_register_write(
- tpname, amqp1_write,
- &(user_data_t){
- .data = instance, .free_func = amqp1_config_instance_free,
- });
+ status =
+ plugin_register_write(tpname, amqp1_write,
+ &(user_data_t){
+ .data = instance,
+ .free_func = amqp1_config_instance_free,
+ });
}
if (status != 0) {
}
if (status != 0) {