git: 4f47e1d88f91 - stable/13 - camcontrol: Plug a memory leak in getdevtree()

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

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

diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 71b2a318ccfe..4b192c48cafd 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);