git: ab328f4e33f8 - main - ctld: Catch exceptions by reference instead of by value

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 07 Aug 2025 21:11:47 UTC
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 (...) {