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)
Thu, Dec 12, 1:24 PM
Unknown Object (File)
Sat, Dec 7, 11:01 AM
Unknown Object (File)
Nov 24 2024, 5:11 PM
Unknown Object (File)
Nov 17 2024, 12:34 PM
Unknown Object (File)
Oct 6 2024, 9:34 AM
Unknown Object (File)
Oct 3 2024, 9:01 AM
Unknown Object (File)
Oct 3 2024, 8:22 AM
Unknown Object (File)
Sep 23 2024, 3:53 AM
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.