Page MenuHomeFreeBSD

Fix a memory leak in grep
Needs ReviewPublic

Authored by trix_juniper.net on Feb 24 2017, 12:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 11 2024, 12:49 AM
Unknown Object (File)
Dec 21 2023, 2:36 PM
Unknown Object (File)
Dec 20 2023, 2:36 AM
Unknown Object (File)
Dec 13 2023, 2:15 PM
Unknown Object (File)
Nov 26 2023, 4:29 AM
Unknown Object (File)
Nov 22 2023, 2:51 AM
Unknown Object (File)
Nov 15 2023, 11:47 AM
Unknown Object (File)
Nov 13 2023, 8:30 PM
Subscribers

Details

Reviewers
stevek
ache
Summary

savedir.c savedir When the realloc of the variable name_space fails, free the memory assigned to name_space before returning

Test Plan

Run clang's static analyzer, scan-build, to reproduce the problem. After, run scan-build again to verify the resolution.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

trix_juniper.net retitled this revision from to Fix a memory leak in grep.
trix_juniper.net updated this object.
trix_juniper.net edited the test plan for this revision. (Show Details)
trix_juniper.net added reviewers: stevek, ache.
trix_juniper.net set the repository for this revision to rS FreeBSD src repository - subversion.

See BSDism reallocf(3) instead, it does free() automatically.

Yes I am aware of the bsd-ism.
Generally it isn¹t a good idea to use ism¹s.
In this case the problem is in grep which is gnu, and not bsd.
Tom

Ah, it is gnu one. Sorry I don't check first. Thats OK.