From: Matthew Barr Date: Mon, 19 Jun 2017 02:53:34 +0000 (+1000) Subject: Catch by reference not value X-Git-Tag: v4.6.0^2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bcb58dea0c74a2692e2ffdfbc1d55d70d53c75b;p=thirdparty%2Fvectorscan.git Catch by reference not value --- diff --git a/src/hs.cpp b/src/hs.cpp index e3c1f811..9305c924 100644 --- a/src/hs.cpp +++ b/src/hs.cpp @@ -262,7 +262,7 @@ hs_compile_multi_int(const char *const *expressions, const unsigned *flags, e.hasIndex ? (int)e.index : -1); return HS_COMPILER_ERROR; } - catch (std::bad_alloc) { + catch (const std::bad_alloc &) { *db = nullptr; *comp_error = const_cast(&hs_enomem); return HS_COMPILER_ERROR; @@ -399,7 +399,7 @@ hs_error_t hs_expression_info_int(const char *expression, unsigned int flags, *error = generateCompileError(e); return HS_COMPILER_ERROR; } - catch (std::bad_alloc) { + catch (std::bad_alloc &) { *error = const_cast(&hs_enomem); return HS_COMPILER_ERROR; }