From: Ruben Kerkhof Date: Sat, 15 Dec 2018 17:29:29 +0000 (+0100) Subject: disk plugin: fix minor style issue X-Git-Tag: collectd-5.9.0~68^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adc145315053e6d86bcdaf3738a7ee763c233e02;p=thirdparty%2Fcollectd.git disk plugin: fix minor style issue --- diff --git a/src/disk.c b/src/disk.c index 7edf44c78..7ceb95a61 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;