X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fascent.c;h=e0b6ba2db7d586c46058a26833f0a2709eba0f01;hb=a019b6c8144745db63c599680bd693ac02f11666;hp=94691d6b08a545e4b72ffad26e09b775a5624db7;hpb=0aad516f24e861109627f4b1dc5bfea3b1f621c1;p=collectd.git diff --git a/src/ascent.c b/src/ascent.c index 94691d6b..e0b6ba2d 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -123,8 +123,8 @@ static int ascent_submit_gauge (const char *plugin_instance, /* {{{ */ vl.values = values; vl.values_len = 1; vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "ascent"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "ascent", sizeof (vl.plugin)); if (plugin_instance != NULL) sstrncpy (vl.plugin_instance, plugin_instance, @@ -271,10 +271,12 @@ static int ascent_xml_submit_gauge (xmlDoc *doc, xmlNode *node, /* {{{ */ value = strtod (str_ptr, &end_ptr); if (str_ptr == end_ptr) { + xmlFree(str_ptr); ERROR ("ascent plugin: ascent_xml_submit_gauge: strtod failed."); return (-1); } } + xmlFree(str_ptr); return (ascent_submit_gauge (plugin_instance, type, type_instance, value)); } /* }}} int ascent_xml_submit_gauge */ @@ -300,10 +302,12 @@ static int ascent_xml_read_int (xmlDoc *doc, xmlNode *node, /* {{{ */ value = strtol (str_ptr, &end_ptr, 0); if (str_ptr == end_ptr) { + xmlFree(str_ptr); ERROR ("ascent plugin: ascent_xml_read_int: strtol failed."); return (-1); } } + xmlFree(str_ptr); *ret_value = value; return (0);