Commit 5c456b2d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Properly eliminate NULL pointer printing in backend ID.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5094 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 4443f38e
...@@ -476,6 +476,7 @@ vdi_simple_fini(struct director *d) ...@@ -476,6 +476,7 @@ vdi_simple_fini(struct director *d)
{ {
struct vdi_simple *vs; struct vdi_simple *vs;
ASSERT_CLI();
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC); CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
......
...@@ -102,10 +102,12 @@ VBE_DropRefLocked(struct backend *b) ...@@ -102,10 +102,12 @@ VBE_DropRefLocked(struct backend *b)
int i; int i;
struct vbc *vbe, *vbe2; struct vbc *vbe, *vbe2;
ASSERT_CLI();
CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
assert(b->refcount > 0); assert(b->refcount > 0);
i = --b->refcount; i = --b->refcount;
b->vsc->vcls--;
Lck_Unlock(&b->mtx); Lck_Unlock(&b->mtx);
if (i > 0) if (i > 0)
return; return;
...@@ -191,6 +193,7 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb) ...@@ -191,6 +193,7 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
memcmp(b->ipv6, vb->ipv6_sockaddr + 1, b->ipv6len))) memcmp(b->ipv6, vb->ipv6_sockaddr + 1, b->ipv6len)))
continue; continue;
b->refcount++; b->refcount++;
b->vsc->vcls++;
return (b); return (b);
} }
...@@ -201,9 +204,12 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb) ...@@ -201,9 +204,12 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
b->refcount = 1; b->refcount = 1;
bprintf(buf, "%s(%s,%s,%s)", bprintf(buf, "%s(%s,%s,%s)",
vb->vcl_name, vb->ipv4_addr, vb->ipv6_addr, vb->port); vb->vcl_name,
vb->ipv4_addr == NULL ? "" : vb->ipv4_addr,
vb->ipv6_addr == NULL ? "" : vb->ipv6_addr, vb->port);
b->vsc = VSM_Alloc(sizeof *b->vsc, VSC_CLASS, VSC_TYPE_VBE, buf); b->vsc = VSM_Alloc(sizeof *b->vsc, VSC_CLASS, VSC_TYPE_VBE, buf);
b->vsc->vcls++;
VTAILQ_INIT(&b->connlist); VTAILQ_INIT(&b->connlist);
......
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