From 04311cc7163ce54d63bd2e764c13d69ea1fce57b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 14 Sep 2011 10:14:02 -0700 Subject: [PATCH] Fix entry_alloc with no attrs --- servers/slapd/back-mdb/id2entry.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.39.5