From: Ruben Kerkhof Date: Sat, 15 Dec 2018 17:29:29 +0000 (+0100) Subject: disk plugin: fix minor style issue X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=adc145315053e6d86bcdaf3738a7ee763c233e02;p=collectd.git disk plugin: fix minor style issue --- diff --git a/src/disk.c b/src/disk.c index 7edf44c7..7ceb95a6 100644 --- a/src/disk.c +++ b/src/disk.c @@ -701,7 +701,7 @@ static int disk_read(void) { break; if (ds == NULL) { - if ((ds = (diskstats_t *)calloc(1, sizeof(diskstats_t))) == NULL) + if ((ds = calloc(1, sizeof(*ds))) == NULL) continue; if ((ds->name = strdup(disk_name)) == NULL) { @@ -989,9 +989,8 @@ static int disk_read(void) { } if (numdisk != pnumdisk || stat_disk == NULL) { - if (stat_disk != NULL) - free(stat_disk); - stat_disk = (perfstat_disk_t *)calloc(numdisk, sizeof(perfstat_disk_t)); + free(stat_disk); + stat_disk = calloc(numdisk, sizeof(*stat_disk)); } pnumdisk = numdisk;