Skip to content

Commit

Permalink
Close directory after use in read_all_proc_fds.
Browse files Browse the repository at this point in the history
Visible in `rr record detach_state` with asan enabled rr build.


==831460==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32816 byte(s) in 1 object(s) allocated from:
    0x7efd2d90de8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    0x7efd2d2df636 in __alloc_dir ../sysdeps/posix/opendir.c:118

SUMMARY: AddressSanitizer: 32816 byte(s) leaked in 1 allocation(s).
  • Loading branch information
bernhardu authored and rocallahan committed Jun 7, 2021
1 parent 2c78ef4 commit 7214d96
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,7 @@ std::vector<int> read_all_proc_fds(pid_t tid)
while (struct dirent *dir = readdir(fddir)) {
ret.push_back(atoi(dir->d_name));
}
closedir(fddir);
return ret;
}

Expand Down

0 comments on commit 7214d96

Please sign in to comment.