return rcode;
}
-
+#ifdef HAVE_REGEX
static int do_regex(REQUEST *request, value_pair_map_t const *map)
{
int compare, rcode, ret;
- regex_t reg, *preg;
- char *lhs, *rhs;
+ regex_t reg, *preg = NULL;
+ char *lhs = NULL, *rhs = NULL;
regmatch_t rxmatch[REQUEST_MAX_REGEX + 1];
/*
ERROR("Failed compiling regular expression: %s", errbuf);
}
EVAL_DEBUG("FAIL %d", __LINE__);
- return -1;
+ ret = -1;
+ goto finish;
}
-
preg = ®
break;
default:
rad_assert(0);
- return -1;
+ ret = -1;
+ goto finish;
}
rcode = radius_expand_tmpl(&lhs, request, map->dst);
ret = (compare == 0);
finish:
+ talloc_free(rhs);
+ talloc_free(lhs);
+
/*
* regcomp allocs extra memory for the expression, so if the
* result wasn't cached we need to free it here.
*/
- if (preg == ®) regfree(®);
+ if (preg && (preg == ®)) regfree(®);
return ret;
}
+#endif
/*
* Copy data from src to dst, where the attributes are of