Commit 97956362 authored by Geoff Simmons's avatar Geoff Simmons

Only allocated the priv_call-scoped re object once (even if regex

compilation fails).
parent 13022358
...@@ -169,6 +169,8 @@ match(struct sess *sp, struct vmod_priv *priv_vcl, struct vmod_priv *priv_call, ...@@ -169,6 +169,8 @@ match(struct sess *sp, struct vmod_priv *priv_vcl, struct vmod_priv *priv_call,
if (re == NULL) { if (re == NULL) {
ALLOC_OBJ(re, RE_MAGIC); ALLOC_OBJ(re, RE_MAGIC);
XXXAN(re); XXXAN(re);
priv_call->priv = re;
priv_call->free = free_re;
} }
re->re = VRE_compile(pattern, 0, &error, &erroffset); re->re = VRE_compile(pattern, 0, &error, &erroffset);
if (re->re == NULL) if (re->re == NULL)
...@@ -177,8 +179,6 @@ match(struct sess *sp, struct vmod_priv *priv_vcl, struct vmod_priv *priv_call, ...@@ -177,8 +179,6 @@ match(struct sess *sp, struct vmod_priv *priv_vcl, struct vmod_priv *priv_call,
"%s (position %d)", pattern, error, "%s (position %d)", pattern, error,
erroffset); erroffset);
else { else {
priv_call->priv = re;
priv_call->free = free_re;
if (dynamic) if (dynamic)
REPLACE(re->pattern, pattern); REPLACE(re->pattern, pattern);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment