Refactor: move potentially failing allocations to earlier

parent cc1cf812
......@@ -316,6 +316,16 @@ vped_include(struct req *preq, const char *src, const char *host,
AN(req);
VSLdbgv(preq, "vped_include: new req=%p", req);
assert(VXID(req->vsl->wid) == VXID(NO_VXID));
pesi2 = pesi_new(req->ws, pesi_tasks);
if (pesi2 == NULL) {
VSLb(req->vsl, SLT_Error,
"Cannot allocate workspace for parallel ESI data");
req_fini(&req, wrk);
tree->retval = -1;
return (-1);
}
req->vsl->wid = VXID_Get(wrk, VSL_CLIENTMARKER);
VSLdbgv(preq, "vped_include: new xid=%ju", VXID(req->vsl->wid));
......@@ -383,15 +393,6 @@ vped_include(struct req *preq, const char *src, const char *host,
req->transport = &VPED_transport;
pesi2 = pesi_new(req->ws, pesi_tasks);
if (pesi2 == NULL) {
VSLb(req->vsl, SLT_Error,
"Cannot allocate workspace for parallel ESI data");
req_fini(&req, wrk);
tree->retval = -1;
return (-1);
}
pesi2->node = node;
req->transport_priv = pesi2;
......
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