]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Might not have any capture data
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 14 Jan 2021 12:14:14 +0000 (12:14 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 14 Jan 2021 12:14:14 +0000 (12:14 +0000)
src/lib/server/regex.c

index 7ccd63072349f4a882e156adb3c53f6adac433c0..1fea13a1577208380035032ea8f74338ab376ca3 100644 (file)
@@ -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) {