diff options
author | Bernhard Reutner-Fischer | 2007-04-05 09:21:24 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer | 2007-04-05 09:21:24 +0000 |
commit | bdd253e4505643808eb5d30a18a727683aada5e5 (patch) | |
tree | 2e465cd3b7d5f61f9eb318c1675ef27e164098de | |
parent | 7d6c9296e7154ef131c318588e66044f71081a05 (diff) | |
download | busybox-bdd253e4505643808eb5d30a18a727683aada5e5.zip busybox-bdd253e4505643808eb5d30a18a727683aada5e5.tar.gz |
- fix segfault in reset_ino_dev_hashtable() when *hashtable was null.
Seen in the testsuite for du -l .../testsuite on exit with CLEAN_UP enabled.
-rw-r--r-- | coreutils/du.c | 6 | ||||
-rw-r--r-- | libbb/inode_hash.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/du.c b/coreutils/du.c index e5fe5ff..e95f3a2 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -235,10 +235,8 @@ int du_main(int argc, char **argv) total += du(*argv); slink_depth = slink_depth_save; } while (*++argv); -#if ENABLE_FEATURE_CLEAN_UP - reset_ino_dev_hashtable(); -#endif - + if (ENABLE_FEATURE_CLEAN_UP) + reset_ino_dev_hashtable(); if (print_final_total) { print(total, "total"); } diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c index 0705102..78c1b0f 100644 --- a/libbb/inode_hash.c +++ b/libbb/inode_hash.c @@ -77,7 +77,7 @@ void reset_ino_dev_hashtable(void) int i; ino_dev_hashtable_bucket_t *bucket; - for (i = 0; i < HASH_SIZE; i++) { + for (i = 0; ino_dev_hashtable && i < HASH_SIZE; i++) { while (ino_dev_hashtable[i] != NULL) { bucket = ino_dev_hashtable[i]->next; free(ino_dev_hashtable[i]); @@ -87,4 +87,6 @@ void reset_ino_dev_hashtable(void) free(ino_dev_hashtable); ino_dev_hashtable = NULL; } +#else +void reset_ino_dev_hashtable(void); #endif |