s4-ldb: ensure new dn_list elements are not owned by caller
authorAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 00:16:30 +0000 (11:16 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 01:47:55 +0000 (12:47 +1100)
source4/lib/ldb/ldb_tdb/ldb_index.c

index 606c24491ccb1d98d1af193ef5ce397fcc484620..a04fb1a8bd2416f1ebbee435a5b70111d0a0ea96 100644 (file)
@@ -1105,7 +1105,7 @@ static int ltdb_index_add1(struct ldb_module *module, const char *dn,
                talloc_free(list);
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       list->dn[list->count].data = discard_const_p(unsigned char, dn);
+       list->dn[list->count].data = (uint8_t *)talloc_strdup(list->dn, dn);
        list->dn[list->count].length = strlen(dn);
        list->count++;