git: f63fd20a9ac2 - stable/13 - bhyvectl: don't leak nvlist in send_message

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Fri, 17 Mar 2023 10:29:29 UTC
The branch stable/13 has been updated by corvink:

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

commit f63fd20a9ac2e88c1b9399b3ef8fc8edb693d192
Author:     Vitaliy Gusev <gusev.vitaliy@gmail.com>
AuthorDate: 2023-03-06 11:32:17 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2023-03-17 10:26:34 +0000

    bhyvectl: don't leak nvlist in send_message
    
    Reviewed by:            corvink, markj
    MFC after:              1 week
    Sponsored by:           vStack
    Differential Revision:  https://reviews.freebsd.org/D38900
    
    (cherry picked from commit 942525ab47e9cd9277ac426e082366d58d7bbe41)
---
 usr.sbin/bhyvectl/bhyvectl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index 59ecbebdfeae..4aa235e00489 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -1704,9 +1704,9 @@ send_message(const char *vmname, nvlist_t *nvl)
 		perror("nvlist_send() failed");
 		err = errno;
 	}
+done:
 	nvlist_destroy(nvl);
 
-done:
 	if (socket_fd >= 0)
 		close(socket_fd);
 	return (err);