diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-05 09:21:24 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-05 09:21:24 +0000 |
commit | 20522c2c938824f6a34ffbe55c4039ca9b7df28b (patch) | |
tree | 2e465cd3b7d5f61f9eb318c1675ef27e164098de | |
parent | e46352cebe5849bea1e2e837ee1572b01422e972 (diff) | |
download | busybox-w32-20522c2c938824f6a34ffbe55c4039ca9b7df28b.tar.gz busybox-w32-20522c2c938824f6a34ffbe55c4039ca9b7df28b.tar.bz2 busybox-w32-20522c2c938824f6a34ffbe55c4039ca9b7df28b.zip |
- 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.
git-svn-id: svn://busybox.net/trunk/busybox@18331 69ca8d6d-28ef-0310-b511-8ec308f3f277
-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 e5fe5ffe2..e95f3a2f1 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -235,10 +235,8 @@ int du_main(int argc, char **argv) | |||
235 | total += du(*argv); | 235 | total += du(*argv); |
236 | slink_depth = slink_depth_save; | 236 | slink_depth = slink_depth_save; |
237 | } while (*++argv); | 237 | } while (*++argv); |
238 | #if ENABLE_FEATURE_CLEAN_UP | 238 | if (ENABLE_FEATURE_CLEAN_UP) |
239 | reset_ino_dev_hashtable(); | 239 | reset_ino_dev_hashtable(); |
240 | #endif | ||
241 | |||
242 | if (print_final_total) { | 240 | if (print_final_total) { |
243 | print(total, "total"); | 241 | print(total, "total"); |
244 | } | 242 | } |
diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c index 0705102b8..78c1b0f9e 100644 --- a/libbb/inode_hash.c +++ b/libbb/inode_hash.c | |||
@@ -77,7 +77,7 @@ void reset_ino_dev_hashtable(void) | |||
77 | int i; | 77 | int i; |
78 | ino_dev_hashtable_bucket_t *bucket; | 78 | ino_dev_hashtable_bucket_t *bucket; |
79 | 79 | ||
80 | for (i = 0; i < HASH_SIZE; i++) { | 80 | for (i = 0; ino_dev_hashtable && i < HASH_SIZE; i++) { |
81 | while (ino_dev_hashtable[i] != NULL) { | 81 | while (ino_dev_hashtable[i] != NULL) { |
82 | bucket = ino_dev_hashtable[i]->next; | 82 | bucket = ino_dev_hashtable[i]->next; |
83 | free(ino_dev_hashtable[i]); | 83 | free(ino_dev_hashtable[i]); |
@@ -87,4 +87,6 @@ void reset_ino_dev_hashtable(void) | |||
87 | free(ino_dev_hashtable); | 87 | free(ino_dev_hashtable); |
88 | ino_dev_hashtable = NULL; | 88 | ino_dev_hashtable = NULL; |
89 | } | 89 | } |
90 | #else | ||
91 | void reset_ino_dev_hashtable(void); | ||
90 | #endif | 92 | #endif |