X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fcurl_xml.c;h=b9f0c24fc56d47599e4f042944e3e1736ad03933;hb=04d03d38dc1e53b30541bbec1a8bdd769c0c6e04;hp=ab18b78083ab58471765a32a48f55ca2e4a805d7;hpb=b59a0c002d8e0c58a3eeb0c82eb01026395b6b7d;p=collectd.git diff --git a/src/curl_xml.c b/src/curl_xml.c index ab18b780..b9f0c24f 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -709,13 +709,12 @@ static int cx_config_add_xpath (cx_t *db, oconfig_item_t *ci) /* {{{ */ int status; int i; - xpath = malloc (sizeof (*xpath)); + xpath = calloc (1, sizeof (*xpath)); if (xpath == NULL) { - ERROR ("curl_xml plugin: malloc failed."); + ERROR ("curl_xml plugin: calloc failed."); return (-1); } - memset (xpath, 0, sizeof (*xpath)); status = cf_util_get_string (ci, &xpath->path); if (status != 0) @@ -923,13 +922,12 @@ static int cx_config_add_url (oconfig_item_t *ci) /* {{{ */ return (-1); } - db = malloc (sizeof (*db)); + db = calloc (1, sizeof (*db)); if (db == NULL) { - ERROR ("curl_xml plugin: malloc failed."); + ERROR ("curl_xml plugin: calloc failed."); return (-1); } - memset (db, 0, sizeof (*db)); db->timeout = -1;