s4:ldb_dn: remove dn->ext_linearized when ext_components is modified.
authorStefan Metzmacher <metze@samba.org>
Fri, 26 Feb 2010 14:48:02 +0000 (15:48 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 26 Feb 2010 22:26:34 +0000 (23:26 +0100)
metze

source4/lib/ldb/common/ldb_dn.c

index c5c8c2e0653ea922f75a4267b7b8bfa52856d1dc..ef4cead0e1d5782df3f33ace1f90e4abcff2fea4 100644 (file)
@@ -894,6 +894,7 @@ void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept)
                        i--;
                }
        }
+       LDB_FREE(dn->ext_linearized);
 }
 
 
@@ -1424,9 +1425,7 @@ bool ldb_dn_add_base(struct ldb_dn *dn, struct ldb_dn *base)
 
        /* Wipe the ext_linearized DN,
         * the GUID and SID are almost certainly no longer valid */
-       if (dn->ext_linearized) {
-               LDB_FREE(dn->ext_linearized);
-       }
+       LDB_FREE(dn->ext_linearized);
 
        LDB_FREE(dn->ext_components);
        dn->ext_comp_num = 0;
@@ -1935,6 +1934,7 @@ int ldb_dn_set_extended_component(struct ldb_dn *dn,
                                }
                                return LDB_SUCCESS;
                        }
+                       LDB_FREE(dn->ext_linearized);
                }
        }
 
@@ -1972,6 +1972,7 @@ void ldb_dn_remove_extended_components(struct ldb_dn *dn)
 {
        dn->ext_comp_num = 0;
        LDB_FREE(dn->ext_components);
+       LDB_FREE(dn->ext_linearized);
 }
 
 bool ldb_dn_is_valid(struct ldb_dn *dn)