From ab328f4e33f8ba7adc7c285fd6aa74254c2e7971 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 7 Aug 2025 17:11:22 -0400 Subject: [PATCH] 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 ab76f8e2ed0..56a149a58a2 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 cb3b0a17cd7..8a62636ffec 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 (...) {