git: 0ab2c922340b - main - ifconfig: free memory allocated by getaddrinfo()

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 24 Mar 2023 07:08:50 UTC
The branch main has been updated by kp:

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

commit 0ab2c922340b8848c79301fdd84548417c0c3023
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2023-03-24 05:25:28 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-03-24 07:08:19 +0000

    ifconfig: free memory allocated by getaddrinfo()
    
    Reported by:    emaste, Coverity
    Sponsored by:   Rubicon Communications, LLC (Netgate)
---
 sbin/ifconfig/carp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c
index 0dc3facdaf79..126a15a230df 100644
--- a/sbin/ifconfig/carp.c
+++ b/sbin/ifconfig/carp.c
@@ -242,6 +242,7 @@ setcarp_peer6(const char *val, int d, int s, const struct afswtch *afp)
 
 	memcpy(&carp_addr6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
 	    sizeof(carp_addr6));
+	freeaddrinfo(res);
 }
 
 static void