These are pointers into the Config's pattern arrays. If the Config is freed before the scanner is destroyed, these pointers become dangling. Currently in the codebase, the scanner is always used within the lifetime of the config, but this is an implicit contract that could be violated by future refactoring.
Location
src/shared/scanner.c:27-31
Suggested Fix
Either:
Deep-copy the pattern arrays into the scanner
Add a documentation comment making the lifetime requirement explicit
Change the scanner to take a Config* and reference patterns through it
Severity
Low
Category
Quality
## Description
In `src/shared/scanner.c` lines 27-31, `directory_scanner_create()` stores pointers to the caller's pattern arrays:
```c
scanner->exclude_patterns = exclude_patterns;
scanner->include_patterns = include_patterns;
```
These are pointers into the `Config`'s pattern arrays. If the `Config` is freed before the scanner is destroyed, these pointers become dangling. Currently in the codebase, the scanner is always used within the lifetime of the config, but this is an implicit contract that could be violated by future refactoring.
## Location
`src/shared/scanner.c:27-31`
## Suggested Fix
Either:
1. Deep-copy the pattern arrays into the scanner
2. Add a documentation comment making the lifetime requirement explicit
3. Change the scanner to take a `Config*` and reference patterns through it
## Severity
Low
## Category
Quality
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
In
src/shared/scanner.clines 27-31,directory_scanner_create()stores pointers to the caller's pattern arrays:These are pointers into the
Config's pattern arrays. If theConfigis freed before the scanner is destroyed, these pointers become dangling. Currently in the codebase, the scanner is always used within the lifetime of the config, but this is an implicit contract that could be violated by future refactoring.Location
src/shared/scanner.c:27-31Suggested Fix
Either:
Config*and reference patterns through itSeverity
Low
Category
Quality