Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Aug 2025 21:11:47 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ab328f4e33f8 - main - ctld: Catch exceptions by reference instead of by value
Message-ID:  <202508072111.577LBl8R094772@gitrepo.freebsd.org>

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

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

commit ab328f4e33f8ba7adc7c285fd6aa74254c2e7971
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-08-07 21:11:22 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-08-07 21:11:22 +0000

    ctld: Catch exceptions by reference instead of by value
    
    Reported by:    GCC -Wcatch-value
    Sponsored by:   Chelsio Communications
---
 usr.sbin/ctld/conf.cc     | 2 +-
 usr.sbin/ctld/uclparse.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/ctld/conf.cc b/usr.sbin/ctld/conf.cc
index ab76f8e2ed0b..56a149a58a25 100644
--- a/usr.sbin/ctld/conf.cc
+++ b/usr.sbin/ctld/conf.cc
@@ -466,7 +466,7 @@ parse_conf(const char *path)
 	bool parsed;
 	try {
 		parsed = yyparse_conf(fp.get());
-	} catch (std::bad_alloc) {
+	} catch (std::bad_alloc &) {
 		log_warnx("failed to allocate memory parsing %s", path);
 		return (false);
 	} catch (...) {
diff --git a/usr.sbin/ctld/uclparse.cc b/usr.sbin/ctld/uclparse.cc
index cb3b0a17cd74..8a62636ffec6 100644
--- a/usr.sbin/ctld/uclparse.cc
+++ b/usr.sbin/ctld/uclparse.cc
@@ -1418,7 +1418,7 @@ uclparse_conf(const char *path)
 	bool parsed;
 	try {
 		parsed = uclparse_toplevel(top);
-	} catch (std::bad_alloc) {
+	} catch (std::bad_alloc &) {
 		log_warnx("failed to allocate memory parsing %s", path);
 		parsed = false;
 	} catch (...) {



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