Skip to content

textfilecontent54 probe: fix memory leaks in process_file#2370

Merged
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
edznux-dd:fix/textfilecontent54-leak
Jun 16, 2026
Merged

textfilecontent54 probe: fix memory leaks in process_file#2370
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
edznux-dd:fix/textfilecontent54-leak

Conversation

@edznux-dd

Copy link
Copy Markdown
Contributor

Found by fuzzing process_file() under ASan/LSan (see harnesses in #2365)

  • create_item()'s returned object was passed to SEXP_list_add(), which takes its own reference, but the caller's reference was never released -> every collected item leaked. Free our reference after adding.
  • The items accumulator list itself was never freed on return. Free it at cleanup; collected items are owned by the probe result object, so this only releases the list's references (and frees any uncollected items).

Found by fuzzing process_file() under ASan/LSan.

- create_item()'s returned object was passed to SEXP_list_add(), which
  takes its own reference, but the caller's reference was never released
  -> every collected item leaked. Free our reference after adding.
- The items accumulator list itself was never freed on return. Free it
  at cleanup; collected items are owned by the probe result object, so
  this only releases the list's references (and frees any uncollected
  items).
@sonarqubecloud

Copy link
Copy Markdown

@jan-cerny jan-cerny self-assigned this Jun 16, 2026
@jan-cerny jan-cerny added this to the 1.4.5 milestone Jun 16, 2026
@jan-cerny jan-cerny merged commit e3c30f2 into OpenSCAP:main Jun 16, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants