From b0e7a52f650f7511f3de63f5d1f76f19a38bb227 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Sun, 13 Sep 2020 10:25:19 +1000 Subject: [PATCH] vmstat: Null the diskstats pointer I'm not sure why, but the make check will now fail for vmstat Running ./vmstat.test/vmstat.exp ... FAIL: vmstat disk information (-d option) With the _new function returning the error. In vmstat all other structures are set to NULL before calling _new except the diskstat ones. This has been corrected. --- vmstat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vmstat.c b/vmstat.c index 71f518a7..269a5a4a 100644 --- a/vmstat.c +++ b/vmstat.c @@ -542,7 +542,7 @@ static void diskpartition_header(const char *partition_name) static void diskpartition_format(const char *partition_name) { #define partVAL(x) DISKSTATS_VAL(x, ul_int, stack, disk_stat) - struct diskstats_info *disk_stat; + struct diskstats_info *disk_stat = NULL; struct diskstats_stack *stack; struct diskstats_result *got; const char format[] = "%21lu %16lu %10lu %16lu\n"; @@ -642,7 +642,7 @@ static void diskheader(void) static void diskformat(void) { #define diskVAL(e,t) DISKSTATS_VAL(e, t, reap->stacks[j], disk_stat) - struct diskstats_info *disk_stat; + struct diskstats_info *disk_stat = NULL; struct diskstats_reaped *reap; int i, j; time_t the_time; @@ -765,7 +765,7 @@ static void slabformat (void) static void disksum_format(void) { #define diskVAL(e,t) DISKSTATS_VAL(e, t, reap->stacks[j], disk_stat) - struct diskstats_info *disk_stat; + struct diskstats_info *disk_stat = NULL; struct diskstats_reaped *reap; int j, disk_count, part_count; unsigned long reads, merged_reads, read_sectors, milli_reading, writes,