From 3fdd5211d96952989fbd7b0cfacd30628c6ab57c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 27 Oct 2022 13:24:35 -0400 Subject: Facilitate memory cleanup --- match.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'match.c') diff --git a/match.c b/match.c index a7b9799..2aa6054 100644 --- a/match.c +++ b/match.c @@ -51,8 +51,8 @@ typedef struct match_ctx_s { static match_t *unused_matches = NULL; static match_t *in_use_matches = NULL; -static void default_error_handler(const char *msg) { - errx(EXIT_FAILURE, "%s", msg); +static void default_error_handler(char **msg) { + errx(EXIT_FAILURE, "%s", *msg); } static bp_errhand_t error_handler = default_error_handler; @@ -881,7 +881,7 @@ bool next_match(match_t **m, const char *start, const char *end, pat_t *pat, pat cache_destroy(&ctx); *m = NULL; if (error_handler) - error_handler(error_message); + error_handler(&error_message); if (error_message) { free(error_message); -- cgit v1.2.3