s4-ldb: better error message when we try to register a module twice
authorAndrew Tridgell <tridge@samba.org>
Sun, 7 Nov 2010 23:58:28 +0000 (10:58 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 8 Nov 2010 00:13:28 +0000 (11:13 +1100)
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/lib/ldb/common/ldb_modules.c

index 7de7cca98910535d8fa1c62c45cd689373ab6f6f..ab06dc57887ca0a94fbccc4179b0bc4d6b5e18fe 100644 (file)
@@ -272,11 +272,12 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
 
 int ldb_register_module(const struct ldb_module_ops *ops)
 {
-       struct ops_list_entry *entry = talloc(talloc_autofree_context(), struct ops_list_entry);
+       struct ops_list_entry *entry;
 
        if (ldb_find_module_ops(ops->name) != NULL)
-               return -1;
+               return LDB_ERR_ENTRY_ALREADY_EXISTS;
 
+       entry = talloc(talloc_autofree_context(), struct ops_list_entry);
        if (entry == NULL)
                return -1;