]> git.saurik.com Git - apple/libc.git/blobdiff - libdarwin/dirstat.c
Libc-1439.40.11.tar.gz
[apple/libc.git] / libdarwin / dirstat.c
index d0b5edf5faa26b3a948cbdaf4b66a0b606ca4376..885bcc1fefc8ad42f8914f2237cd9fefade0c85e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2017 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
@@ -219,6 +219,7 @@ fdirstat_fallback(int parent_fd, int flags, struct dirstat *ds)
 
                        if (fd < 0) {
                                DEBUGPRINT( "Unable to open directory %d:%s => %s\n", parent_fd, path, strerror(errno));
+                               free(path);
                                continue;
                        }
                }
@@ -335,8 +336,8 @@ fdirstat_fallback(int parent_fd, int flags, struct dirstat *ds)
                                                if (1 == attrs.link_count) {
                                                        ds->total_size += object_size;
                                                } else {
-                                                       bool new_fileid = _dirstat_fileid_set_add(fileid_seen, attrs.fileid);
-                                                       if (new_fileid) {
+                                                       bool seen_fileid = _dirstat_fileid_set_add(fileid_seen, attrs.fileid);
+                                                       if (!seen_fileid) {
                                                                ds->total_size += object_size;
                                                        } else {
                                                                DEBUGPRINT( "Skipping hardlinked file at %s/%s\n", path, name);