fix mem leak in ltdb_index_dn_base_dn and ltdb_search_indexed
authorAndrej Gessel <Andrej.Gessel@janztec.com>
Mon, 16 Jul 2018 09:39:05 +0000 (11:39 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 15 Aug 2018 05:08:24 +0000 (07:08 +0200)
Signed-off-by: Andrej Gessel <Andrej.Gessel@janztec.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/ldb/ldb_key_value/ldb_kv_index.c

index 4e9d9043bfd59bba60f66012f89fa124a61501f4..6c21c19d65473dc2356c3e846420af9b18eb3ab9 100644 (file)
@@ -1684,6 +1684,7 @@ static int ldb_kv_index_dn_base_dn(struct ldb_module *module,
                dn_list->dn[0].data = discard_const_p(unsigned char,
                                                      ldb_dn_get_linearized(base_dn));
                if (dn_list->dn[0].data == NULL) {
+                       talloc_free(dn_list->dn);
                        return ldb_module_oom(module);
                }
                dn_list->dn[0].length = strlen((char *)dn_list->dn[0].data);
@@ -2039,6 +2040,7 @@ int ldb_kv_search_indexed(struct ldb_kv_context *ac, uint32_t *match_count)
                        struct dn_list *idx_one_tree_list
                                = talloc_zero(ac, struct dn_list);
                        if (idx_one_tree_list == NULL) {
+                               talloc_free(dn_list);
                                return ldb_module_oom(ac->module);
                        }