X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fmodbus.c;h=d2b0a535ff9a0dd135f05fe2b217145ccc9c0315;hb=5293f334d4bbdc746b42d3dfebd5ef1680b58d05;hp=04abe04ead52f815c3a1ecff05b9d4bb05208e80;hpb=1b15b227585497f72ab0e42d96d79c0313323bd4;p=collectd.git diff --git a/src/modbus.c b/src/modbus.c index 04abe04e..d2b0a535 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -27,7 +27,7 @@ #include -#include +#include #ifndef LIBMODBUS_VERSION_CHECK /* Assume version 2.0.3 */ @@ -440,7 +440,7 @@ static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */ if (ds->ds_num != 1) { - ERROR ("Modbus plugin: The type \"%s\" has %i data sources. " + ERROR ("Modbus plugin: The type \"%s\" has %zu data sources. " "I can only handle data sets with only one data source.", data->type, ds->ds_num); return (-1); @@ -942,9 +942,15 @@ static int mb_config_add_host (oconfig_item_t *ci) /* {{{ */ status = cf_util_get_string_buffer (ci, host->host, sizeof (host->host)); if (status != 0) + { + sfree (host); return (status); + } if (host->host[0] == 0) + { + sfree (host); return (EINVAL); + } for (i = 0; i < ci->children_num; i++) {