]> git.sur5r.net Git - openldap/commitdiff
let c_conn_idx be -1 (ITS#5235?)
authorPierangelo Masarati <ando@openldap.org>
Sat, 17 Nov 2007 13:39:19 +0000 (13:39 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 17 Nov 2007 13:39:19 +0000 (13:39 +0000)
servers/slapd/overlays/ppolicy.c

index cc401aefaaa6fb69d35db740911063e87a12dd14..b7f32c3570d57d2162ee4615d3b0a52f5c891a4e 100644 (file)
@@ -2121,8 +2121,11 @@ ppolicy_db_init(
 
        on->on_bi.bi_private = ch_calloc( sizeof(pp_info), 1 );
 
-       if ( dtblsize && !pwcons )
-               pwcons = ch_calloc(sizeof(pw_conn), dtblsize );
+       if ( dtblsize && !pwcons ) {
+               /* accommodate for c_conn_idx == -1 */
+               pwcons = ch_calloc( sizeof(pw_conn), dtblsize + 1 );
+               pwcons++;
+       }
 
        return 0;
 }
@@ -2149,6 +2152,7 @@ ppolicy_close(
        /* Perhaps backover should provide bi_destroy hooks... */
        ov_count--;
        if ( ov_count <=0 && pwcons ) {
+               pwcons--;
                free( pwcons );
                pwcons = NULL;
        }