git: 1787871a6627 - main - bhyve: avoid resource leak
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 May 2024 17:20:16 UTC
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);
}