]> git.sur5r.net Git - openldap/commitdiff
fix ITS#5327 crasher
authorPierangelo Masarati <ando@openldap.org>
Tue, 15 Jan 2008 20:32:35 +0000 (20:32 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 15 Jan 2008 20:32:35 +0000 (20:32 +0000)
servers/slapd/overlays/constraint.c

index b2c92f0f5c26f5e759ed555841ba6006dc2b5de9..8ce8a0fc6aa722812b1aa0008d5b55336dd52cfb 100644 (file)
@@ -275,14 +275,16 @@ constraint_cf_gen( ConfigArgs *c )
                                return ( ARG_BAD_CONF );
                        }
 
-                       a2 = ch_malloc( sizeof(constraint) );
+                       a2 = ch_calloc( sizeof(constraint), 1 );
                        a2->ap_next = on->on_bi.bi_private;
                        a2->ap = ap.ap;
                        a2->re = ap.re;
                        a2->val = ap.val;
                        a2->lud = ap.lud;
-                       ber_str2bv(a2->lud->lud_dn, 0, 0, &a2->dn);
-                       ber_str2bv(a2->lud->lud_filter, 0, 0, &a2->filter);
+                       if ( a2->lud ) {
+                               ber_str2bv(a2->lud->lud_dn, 0, 0, &a2->dn);
+                               ber_str2bv(a2->lud->lud_filter, 0, 0, &a2->filter);
+                       }
                        a2->attrs = ap.attrs;
                        on->on_bi.bi_private = a2;
                        break;