aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/du
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
commit98e0ffaefb0f241cda3a72395d3be04192ae0d47 (patch)
tree55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/du
parentb17ff922d4072ae132ece458f5b5d74a236880ac (diff)
parente81032ad243db32b8fd615b2d55ee94b9f6a5b6a (diff)
downloadsrc-98e0ffaefb0f241cda3a72395d3be04192ae0d47.tar.gz
src-98e0ffaefb0f241cda3a72395d3be04192ae0d47.zip
Merge sync of head
Notes
Notes: svn path=/projects/bmake/; revision=283595
Diffstat (limited to 'usr.bin/du')
-rw-r--r--usr.bin/du/Makefile3
-rw-r--r--usr.bin/du/du.c7
2 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/du/Makefile b/usr.bin/du/Makefile
index f614866da6de..9f96ec657a7e 100644
--- a/usr.bin/du/Makefile
+++ b/usr.bin/du/Makefile
@@ -2,7 +2,6 @@
# $FreeBSD$
PROG= du
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
.include <bsd.prog.mk>
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 6194a127d73a..506c3f5b4338 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -376,7 +376,7 @@ linkchk(FTSENT *p)
/* If the hash table is getting too full, enlarge it. */
if (number_entries > number_buckets * 10 && !stop_allocating) {
new_size = number_buckets * 2;
- new_buckets = malloc(new_size * sizeof(struct links_entry *));
+ new_buckets = calloc(new_size, sizeof(struct links_entry *));
/* Try releasing the free list to see if that helps. */
if (new_buckets == NULL && free_list != NULL) {
@@ -385,16 +385,13 @@ linkchk(FTSENT *p)
free_list = le->next;
free(le);
}
- new_buckets = malloc(new_size *
- sizeof(new_buckets[0]));
+ new_buckets = calloc(new_size, sizeof(new_buckets[0]));
}
if (new_buckets == NULL) {
stop_allocating = 1;
warnx("No more memory for tracking hard links");
} else {
- memset(new_buckets, 0,
- new_size * sizeof(struct links_entry *));
for (i = 0; i < number_buckets; i++) {
while (buckets[i] != NULL) {
/* Remove entry from old bucket. */