Page MenuHomeFreeBSD

Fix memory leaks in mdmfs
Needs ReviewPublic

Authored by trix_juniper.net on Feb 23 2017, 4:47 PM.

Details

Reviewers
stevek
ak
Summary

mdmfs.c main : the local variable mdconfig_arg is allocated but never freed.

mdmfs.c do_mdconfig_attach_au : the local variable linebuf is allocated but never freed.

In both cases, free the memory after its last use.

Test Plan

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

Diff Detail

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

Event Timeline

trix_juniper.net retitled this revision from to Fix memory leaks in mdmfs.
trix_juniper.net updated this object.
trix_juniper.net edited the test plan for this revision. (Show Details)
trix_juniper.net added reviewers: stevek, ak.
trix_juniper.net set the repository for this revision to rS FreeBSD src repository.
ak edited edge metadata.Feb 23 2017, 8:21 PM

Shouldn't you also free newfs_arg and mount_arg ?

trix_juniper.net edited edge metadata.

I agree these should also be freed.
I took a second look at the scan-view output and it did not complain which is troubling.