Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2024 17:20:16 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1787871a6627 - main - bhyve: avoid resource leak
Message-ID:  <202405161720.44GHKGiO043924@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit 1787871a6627cc1a49ce7ceea8133b394ea7f486
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2024-05-13 17:26:11 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-16 17:19:33 +0000

    bhyve: avoid resource leak
    
    In bhyve_parse_config_option(), a string is allocated and passed to
    nvlist_add_string() but not free'd afterwards.
    
    Reported by:    Coverity
    CID:            1544049
    Sponsored by:   The FreeBSD Foundation
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1234
---
 usr.sbin/bhyve/bhyverun.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index d199c32cc54b..aca770a92642 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -593,6 +593,7 @@ bhyve_parse_config_option(const char *option)
 	if (path == NULL)
 		err(4, "Failed to allocate memory");
 	set_config_value(path, value + 1);
+	free(path);
 	return (true);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405161720.44GHKGiO043924>