Skip to content

Fix MEMORY_LEAK.EX in delete_all.c#513

Merged
stevegrubb merged 1 commit intolinux-audit:masterfrom
mikhailnov:svace8
Feb 28, 2026
Merged

Fix MEMORY_LEAK.EX in delete_all.c#513
stevegrubb merged 1 commit intolinux-audit:masterfrom
mikhailnov:svace8

Conversation

@mikhailnov
Copy link
Contributor

Add list_clear(&l) before returning -1 on error paths to prevent memory leak of rule list allocated by list_append().

Svace report:
Dynamic memory, referenced by 'newnode->r', is allocated at
delete_all.c:87 by calling function 'list_append' and lost at
delete_all.c:79. (CWE401, CWE404, CWE775)

Add list_clear(&l) before returning -1 on error paths to prevent
memory leak of rule list allocated by list_append().

Svace report:
  Dynamic memory, referenced by 'newnode->r', is allocated at
  delete_all.c:87 by calling function 'list_append' and lost at
  delete_all.c:79. (CWE401, CWE404, CWE775)

Co-authored-by: Z.AI GLM-5
@stevegrubb
Copy link
Contributor

This is only used by auditctl -D. Thanks for the patch.

@stevegrubb stevegrubb merged commit f8c85b8 into linux-audit:master Feb 28, 2026
4 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