Bug 275338 - sbin/camcontrol/camcontrol.c getdevtree() memory leak
Summary: sbin/camcontrol/camcontrol.c getdevtree() memory leak
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-25 20:02 UTC by firk
Modified: 2024-11-04 15:40 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description firk 2023-11-25 20:02:38 UTC
Possible memory leak, completely harmless for now, but:

sbin/camcontrol/camcontrol.c getdevtree() allocates an array:

> ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize);

and I see no corresponding free().
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-10-28 15:15:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=abfd031b482f92320e29a2c2ac80fcd23e134446

commit abfd031b482f92320e29a2c2ac80fcd23e134446
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-28 13:52:32 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-10-28 15:14:36 +0000

    camcontrol: Plug a memory leak in getdevtree()

    PR:             275338
    MFC after:      1 week

 sbin/camcontrol/camcontrol.c | 1 +
 1 file changed, 1 insertion(+)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-11-04 15:39:44 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a07e99407eac4211de2d985b39b4c77e94beb09

commit 5a07e99407eac4211de2d985b39b4c77e94beb09
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-28 13:52:32 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-04 15:38:35 +0000

    camcontrol: Plug a memory leak in getdevtree()

    PR:             275338
    MFC after:      1 week

    (cherry picked from commit abfd031b482f92320e29a2c2ac80fcd23e134446)

 sbin/camcontrol/camcontrol.c | 1 +
 1 file changed, 1 insertion(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-11-04 15:39:45 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f47e1d88f9107af16ffea5d36c505b1fcc44944

commit 4f47e1d88f9107af16ffea5d36c505b1fcc44944
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-28 13:52:32 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-04 15:38:53 +0000

    camcontrol: Plug a memory leak in getdevtree()

    PR:             275338
    MFC after:      1 week

    (cherry picked from commit abfd031b482f92320e29a2c2ac80fcd23e134446)

 sbin/camcontrol/camcontrol.c | 1 +
 1 file changed, 1 insertion(+)
Comment 4 Mark Johnston freebsd_committer freebsd_triage 2024-11-04 15:40:45 UTC
Thanks for the report.