Page MenuHomeFreeBSD

Fix memory leaks in libdtrace
ClosedPublic

Authored by trix_juniper.net on Feb 21 2017, 7:18 PM.
Tags
None
Referenced Files
F137047636: D9705.id25631.diff
Fri, Nov 21, 1:19 AM
F137045556: D9705.id25492.diff
Fri, Nov 21, 1:13 AM
F137045199: D9705.id.diff
Fri, Nov 21, 1:12 AM
F137044037: D9705.diff
Fri, Nov 21, 1:09 AM
Unknown Object (File)
Tue, Nov 18, 9:46 PM
Unknown Object (File)
Thu, Nov 13, 5:52 PM
Unknown Object (File)
Mon, Nov 3, 8:56 PM
Unknown Object (File)
Sat, Nov 1, 12:47 AM

Details

Summary

dt_open.c dt_provmod_open
When realloc fails, the original pointer is still valid, so it must be freed.

dt_open.c dt_vopen
When the malloc of dtp fails, the memory/structure previously assigned to provmod must be freed. dt_provmod_destroy handles the case when provmod == NULL so there is no need for special handling of jumping over the setup of provmod.

dt_strtab.c dt_strtab_insert
When the call to dt_strtab_copyin fails, it is necessary to free the locally allocated memory assigned to 'hp' before returning early.

Test Plan

Run clang's static analyzer scan-build before to reproduce the problem, run scan-build after to verify resolution of the problem.

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 memory leaks in libdtrace.
trix_juniper.net updated this object.
trix_juniper.net edited the test plan for this revision. (Show Details)
trix_juniper.net set the repository for this revision to rS FreeBSD src repository - subversion.
markj edited edge metadata.
This revision is now accepted and ready to land.Feb 21 2017, 10:27 PM
This revision was automatically updated to reflect the committed changes.