From 1b98cd6262e5a9b9a842059b37c0c9a7429dbbb4 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 2 Mar 2004 20:31:37 +0000 Subject: [PATCH] Fix SLAPI_ADD_RESCONTROLS --- servers/slapd/slapi/slapi_pblock.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index da0a017d93..503c2c0149 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -321,8 +321,13 @@ set( Slapi_PBlock *pb, int param, void *val ) LDAPControl **ctrls = pb->curVals[i]; int j; - for (j=0; ctrls[j]; j++); - ctrls = ch_realloc( ctrls, (j+2)*sizeof(LDAPControl *) ); + if ( ctrls ) { + for (j=0; ctrls[j]; j++); + ctrls = ch_realloc( ctrls, (j+2)*sizeof(LDAPControl *) ); + } else { + ctrls = ch_malloc( 2 * sizeof(LDAPControl *) ); + j = 0; + } ctrls[j] = val; ctrls[j+1] = NULL; pb->curVals[i] = ctrls; -- 2.39.5