]> git.sur5r.net Git - openldap/commitdiff
Better fix for prev commit
authorHoward Chu <hyc@openldap.org>
Mon, 6 Dec 2004 07:38:09 +0000 (07:38 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 6 Dec 2004 07:38:09 +0000 (07:38 +0000)
servers/slapd/schema_init.c

index 95190c90536952faf8d1f5551ea62b42dbd48e86..6421cacf7791470e2857fd5cfb87c7434ecdd79c 100644 (file)
@@ -2729,12 +2729,11 @@ int generalizedTimeFilter(
        
        bvtmp.bv_len = sizeof(tmp);
        bvtmp.bv_val = tmp;
-       keys = slap_sl_malloc( sizeof( struct berval ) * 2, ctx );
-
        /* GeneralizedTime YYYYmmddHH[MM[SS]][(./,)d...](Z|(+/-)HH[MM]) */
        /* Use 40 bits of time for key */
        if ( value->bv_val && value->bv_len >= 10 &&
                lutil_parsetime( value->bv_val, &tm ) == 0 ) {
+
                lutil_tm2time( &tm, &tt );
                tmp[0] = tt.tt_gsec & 0xff;
                tmp[4] = tt.tt_sec & 0xff;
@@ -2745,15 +2744,14 @@ int generalizedTimeFilter(
                tt.tt_sec >>= 8;
                tmp[1] = tt.tt_sec & 0xff;
 
+               keys = slap_sl_malloc( sizeof( struct berval ) * 2, ctx );
                ber_dupbv_x(keys, &bvtmp, ctx );
+               keys[1].bv_val = NULL;
+               keys[1].bv_len = 0;
        } else {
-               keys[0].bv_val = NULL;
-               keys[0].bv_len = 0;
+               keys = NULL;
        }
 
-       keys[1].bv_val = NULL;
-       keys[1].bv_len = 0;
-
        *keysp = keys;
 
        return LDAP_SUCCESS;