]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9473 Fix cn=config memory leaks in slapo-variant
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 15 Jun 2021 09:24:00 +0000 (10:24 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 21 Jun 2021 16:36:06 +0000 (16:36 +0000)
contrib/slapd-modules/variant/variant.c

index b6f2ee8b2eb9956aa42892577287dd34e11d23a3..42d1c76acdd2a71b015c590f05cf62d5c46922bd 100644 (file)
@@ -918,6 +918,7 @@ variant_set_regex( ConfigArgs *ca )
        vei->regex = ch_calloc( 1, sizeof(regex_t) );
        if ( regcomp( vei->regex, vei->dn.bv_val, REG_EXTENDED ) ) {
                ch_free( vei->regex );
+               ch_free( vei->dn.bv_val );
                return LDAP_CONSTRAINT_VIOLATION;
        }
 
@@ -1142,6 +1143,7 @@ variant_ldadd_cleanup( ConfigArgs *ca )
 
        if ( ca->reply.err != LDAP_SUCCESS ) {
                assert( LDAP_SLIST_EMPTY(&vei->attributes) );
+               ch_free( vei->dn.bv_val );
                ch_free( vei );
                return LDAP_SUCCESS;
        }
@@ -1222,6 +1224,7 @@ variant_attr_ldadd_cleanup( ConfigArgs *ca )
        variantEntry_info *vei = vai->variant;
 
        if ( ca->reply.err != LDAP_SUCCESS ) {
+               ch_free( vai->dn.bv_val );
                ch_free( vai );
                return LDAP_SUCCESS;
        }
@@ -1372,6 +1375,8 @@ variant_db_destroy( BackendDB *be, ConfigReply *cr )
                                ch_free( vai );
                        }
                        ber_memfree( vei->dn.bv_val );
+                       regfree( vei->regex );
+                       ch_free( vei->regex );
                        ch_free( vei );
                }
                ch_free( ov );