Page MenuHomeFreeBSD

Fix a memory leak with fw_check_device_ready
AbandonedPublic

Authored by stevek on Feb 18 2017, 1:02 PM.

Details

Summary

The memory assigned to the local variable 'ptr' is freed

Test Plan

Run clang's static analyzer scan-build before to find the problem. Run scan-build after to verify the problem is fixed.

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 a memory leak with fw_check_device_ready.
trix_juniper.net updated this object.
trix_juniper.net edited the test plan for this revision. (Show Details)
trix_juniper.net added reviewers: stevek, ken.
trix_juniper.net set the repository for this revision to rS FreeBSD src repository.
ken requested changes to this revision.Feb 20 2017, 2:43 PM
ken edited edge metadata.

Just take out the if statement and it's fine.

sbin/camcontrol/fwdownload.c
760

Good catch. Since ptr is always either NULL or malloced memory, you can just pass it in to free(3) without the if statement. (free(3) will do nothing if the pointer is NULL.)

This revision now requires changes to proceed.Feb 20 2017, 2:43 PM
stevek commandeered this revision.May 18 2019, 5:46 PM
stevek edited reviewers, added: trix_juniper.net; removed: stevek.

I will update and commit with the requested changes.

stevek abandoned this revision.May 18 2019, 5:51 PM

Abandon, since this has already been addressed.