git: 5a07e99407ea - stable/14 - camcontrol: Plug a memory leak in getdevtree()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 04 Nov 2024 15:38:42 UTC
The branch stable/14 has been updated by markj:

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(+)

diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index db26b45ac508..3348d759b913 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -652,6 +652,7 @@ getdevtree(int argc, char **argv, char *combinedopt)
 	if (need_close)
 		fprintf(stdout, ")\n");
 
+	free(ccb.cdm.matches);
 	close(fd);
 
 	return (error);