Page MenuHomeFreeBSD

Fix a memory leak with fw_check_device_ready
AbandonedPublic

Authored by stevek on Feb 18 2017, 1:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 12:00 AM
Unknown Object (File)
Dec 20 2023, 12:57 AM
Unknown Object (File)
Dec 13 2023, 1:05 AM
Unknown Object (File)
Oct 25 2023, 9:58 AM
Unknown Object (File)
Aug 21 2023, 12:31 PM
Unknown Object (File)
Jul 23 2023, 6:43 PM
Unknown Object (File)
Jun 7 2023, 3:32 AM
Unknown Object (File)
May 8 2023, 2:01 AM
Subscribers

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 - subversion
Lint
Lint Skipped
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 - subversion.
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 edited reviewers, added: trix_juniper.net; removed: stevek.

I will update and commit with the requested changes.

Abandon, since this has already been addressed.