diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-04-02 05:34:07 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-04-03 14:27:27 +0100 |
commit | bf180f8f5a53eb82054e85e26dcd1ea7c43dbdfe (patch) | |
tree | 401ee5186c164b9e9ed4f4ac74efa6630d4a9fa8 | |
parent | ccf1cd87f8b0c1cb5f5801a6be1ce8f44a165a19 (diff) | |
download | coreutils-bf180f8f5a53eb82054e85e26dcd1ea7c43dbdfe.tar.xz |
df: fix use of uninitialized variable reported by valgrind
Conditional jump or move depends on uninitialised value(s)
at 0x40380C: get_field_values (df.c:840)
by 0x403E16: get_dev (df.c:994)
by 0x404D65: get_all_entries (df.c:1364)
by 0x405926: main (df.c:1714)
* src/df.c (get_dev): Initialize the fsu.fsu_bavail_top_bit_set
member, when adding placeholder entries.
(main): Avoid a "definitely lost" memory leak warning from valgrind,
reported by Bernhard Voelker.
-rw-r--r-- | src/df.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -925,6 +925,7 @@ get_dev (char const *disk, char const *mount_point, char const* file, return; fstype = "-"; + fsu.fsu_bavail_top_bit_set = false; fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree = fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX; } @@ -949,6 +950,7 @@ get_dev (char const *disk, char const *mount_point, char const* file, && (! dev_me->me_remote || ! me_remote)) { fstype = "-"; + fsu.fsu_bavail_top_bit_set = false; fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree = fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX; } @@ -1709,6 +1711,8 @@ main (int argc, char **argv) for (i = optind; i < argc; ++i) if (argv[i]) get_entry (argv[i], &stats[i - optind]); + + IF_LINT (free (stats)); } else get_all_entries (); |