From: Ruben Kerkhof Date: Fri, 1 Apr 2016 15:18:42 +0000 (+0200) Subject: mysql plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~30 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=aacc2e30f17fa2e47ac8d2531ac69bb748304296;p=collectd.git mysql plugin: malloc + memset -> calloc --- diff --git a/src/mysql.c b/src/mysql.c index 029796e6..4c94732b 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -113,13 +113,12 @@ static int mysql_config_database (oconfig_item_t *ci) /* {{{ */ return (-1); } - db = malloc (sizeof (*db)); + db = calloc (1, sizeof (*db)); if (db == NULL) { - ERROR ("mysql plugin: malloc failed."); + ERROR ("mysql plugin: calloc failed."); return (-1); } - memset (db, 0, sizeof (*db)); /* initialize all the pointers */ db->alias = NULL;