]> git.saurik.com Git - apple/libc.git/blobdiff - libdarwin/dirstat.c
Libc-1439.40.11.tar.gz
[apple/libc.git] / libdarwin / dirstat.c
index 89b0a83115c552cfca854b016959c95e31544da6..885bcc1fefc8ad42f8914f2237cd9fefade0c85e 100644 (file)
@@ -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);