fix: scanner cur_path leak when directory enqueued (ASan)
CI / lint (pull_request) Successful in 12s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 10s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
CI / lint (pull_request) Successful in 12s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 10s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 54s
This commit is contained in:
@@ -138,10 +138,12 @@ Chunk* directory_scanner_next(DirectoryScanner* scanner) {
|
||||
|
||||
if (S_ISDIR(stats.st_mode)) {
|
||||
int next_depth = scanner->current_depth + 1;
|
||||
if (scanner->max_depth <= 0 || next_depth < scanner->max_depth)
|
||||
queue_enqueue(scanner->directories, dir_entry_create(cur_path, next_depth));
|
||||
else
|
||||
free(cur_path);
|
||||
if (scanner->max_depth <= 0 || next_depth < scanner->max_depth) {
|
||||
DirEntry* de = dir_entry_create(cur_path, next_depth);
|
||||
if (!queue_enqueue(scanner->directories, de))
|
||||
dir_entry_destroy(de);
|
||||
}
|
||||
free(cur_path);
|
||||
} else {
|
||||
if (scanner->max_depth > 0 && scanner->current_depth + 1 > scanner->max_depth) {
|
||||
free(cur_path);
|
||||
|
||||
Reference in New Issue
Block a user