]> git.sur5r.net Git - openldap/commitdiff
Fix SLAPI_ADD_RESCONTROLS
authorHoward Chu <hyc@openldap.org>
Tue, 2 Mar 2004 20:31:37 +0000 (20:31 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 2 Mar 2004 20:31:37 +0000 (20:31 +0000)
servers/slapd/slapi/slapi_pblock.c

index da0a017d9337303fd5e8b908cd66b862ea5c242d..503c2c014944a45d6b0293cfd01548992761324b 100644 (file)
@@ -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;