From: Howard Chu Date: Wed, 14 Sep 2011 17:14:02 +0000 (-0700) Subject: Fix entry_alloc with no attrs X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=04311cc7163ce54d63bd2e764c13d69ea1fce57b;p=openldap Fix entry_alloc with no attrs --- diff --git a/servers/slapd/back-mdb/id2entry.c b/servers/slapd/back-mdb/id2entry.c index 757f21041b..2d0e00e4a0 100644 --- a/servers/slapd/back-mdb/id2entry.c +++ b/servers/slapd/back-mdb/id2entry.c @@ -177,8 +177,12 @@ static Entry * mdb_entry_alloc( nvals * sizeof(struct berval), op->o_tmpmemctx ); BER_BVZERO(&e->e_bv); e->e_private = e; - e->e_attrs = (Attribute *)(e+1); - e->e_attrs->a_vals = (struct berval *)(e->e_attrs+nattrs); + if (nattrs) { + e->e_attrs = (Attribute *)(e+1); + e->e_attrs->a_vals = (struct berval *)(e->e_attrs+nattrs); + } else { + e->e_attrs = NULL; + } return e; }