From: Arran Cudbard-Bell Date: Thu, 14 Jan 2021 12:14:14 +0000 (+0000) Subject: Might not have any capture data X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=089bc1e40a68b8de306e9f0734ab53f6b810f349;p=thirdparty%2Ffreeradius-server.git Might not have any capture data --- diff --git a/src/lib/server/regex.c b/src/lib/server/regex.c index 7ccd6307234..1fea13a1577 100644 --- a/src/lib/server/regex.c +++ b/src/lib/server/regex.c @@ -299,16 +299,18 @@ int regex_request_to_sub(TALLOC_CTX *ctx, char **out, request_t *request, uint32 int regex_request_to_sub_named(TALLOC_CTX *ctx, char **out, request_t *request, char const *name) { fr_regcapture_t *rc; + void *rd; char const *p; int ret; - rc = talloc_get_type_abort(request_data_reference(request, request, REQUEST_DATA_REGEX), fr_regcapture_t); - if (!rc) { + rd = request_data_reference(request, request, REQUEST_DATA_REGEX); + if (!rd) { RDEBUG4("No subcapture data found"); *out = NULL; return -1; } + rc = talloc_get_type_abort(rd, fr_regcapture_t); ret = pcre_get_named_substring(rc->preg->compiled, rc->regmatch->subject, (int *)rc->regmatch->match_data, (int)rc->regmatch->used, name, &p); switch (ret) {