Commit 4e5107db authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Attempt to allocate the htc before the backend connection,

its cheaper to eliminate the exceedingly unlikely resource leak
Coverity spotted that way.
parent 7f71fe6e
......@@ -105,11 +105,18 @@ vbe_dir_getfd(const struct director *d, struct busyobj *bo)
return (-1);
}
AZ(bo->htc);
bo->htc = WS_Alloc(bo->ws, sizeof *bo->htc);
if (bo->htc == NULL)
/* XXX: counter ? */
return (-1);
FIND_TMO(connect_timeout, tmod, bo, vrt);
vc = VBT_Get(bp->tcp_pool, tmod);
if (vc == NULL) {
// XXX: Per backend stats ?
VSC_C_main->backend_fail++;
bo->htc = NULL;
return (-1);
}
......@@ -129,11 +136,6 @@ vbe_dir_getfd(const struct director *d, struct busyobj *bo)
vc->fd, bp->display_name, abuf2, pbuf2, abuf1, pbuf1);
vc->backend->vsc->req++;
AZ(bo->htc);
bo->htc = WS_Alloc(bo->ws, sizeof *bo->htc);
if (bo->htc == NULL)
/* XXX: counter ? */
return (-1);
INIT_OBJ(bo->htc, HTTP_CONN_MAGIC);
bo->htc->vbc = vc;
bo->htc->fd = vc->fd;
......
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