diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-05-01 10:22:47 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2008-05-01 10:22:47 -0400 |
commit | f86e8be3f89fe64020aa0bc0d07590aa2ed65250 (patch) | |
tree | 8f97d1373c8fd9ffbd39474f5ae38f310a1b782a /utils.c | |
parent | 9a34051c5183ef91674420f4326da2390d7e4be6 (diff) |
Fix uninitialized variables, and use -O so gcc starts checking for them
Gcc only sends warnings for uninitialized variables when you compile with -O,
and there were a couple of bugs sprinkled in the code. The biggest was the
alloc_start variable for mkfs, which can cause strange things to happen.
(thanks to Gabor Micsko for helping to find this)
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -645,7 +645,7 @@ int btrfs_register_one_device(char *fname) int btrfs_scan_one_dir(char *dirname, int run_ioctl) { - DIR *dirp; + DIR *dirp = NULL; struct dirent *dirent; struct pending_dir *pending; struct stat st; @@ -734,7 +734,8 @@ again: ret = 0; fail: free(pending); - closedir(dirp); + if (dirp) + closedir(dirp); return ret; } |