Commit a5e55971 authored by Nils Goroll's avatar Nils Goroll

we do not need to copy subject, it is immutable ...

... and has at least TASK lifetime anyway.

Thank you for catching this @geoff
parent 01c613af
......@@ -186,14 +186,8 @@ match(VRT_CTX, vre_t *vre, VCL_STRING subject, struct vmod_priv *task,
}
task->len = sizeof(*ov);
if (WS_Inside(ctx->ws, subject, subject + len))
ov->subject = subject;
else if ((ov->subject = WS_Copy(ctx->ws, (const void *) subject, len))
== NULL) {
VSLb(ctx->vsl, SLT_VCL_Error,
"vmod re: insufficient workspace");
return 0;
}
ov->subject = subject;
memset(ov->ovector, -1, sizeof(ov->ovector));
cp = s * 2 * sizeof(*nov);
assert(cp <= sizeof(nov));
......@@ -237,7 +231,6 @@ backref(VRT_CTX, VCL_INT refnum, VCL_STRING fallback, struct vmod_priv *task)
start = ov->subject + ov->ovector[refnum];
len = ov->ovector[refnum+1] - ov->ovector[refnum];
assert(len <= ov->ovector[1] - ov->ovector[0]);
WS_Assert_Allocated(ctx->ws, start, len + 1);
if (start[len] == '\0')
substr = start;
else
......
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