summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-07-16 16:17:56 +0200
committerStefan Metzmacher <metze@samba.org>2014-07-17 00:51:57 +0200
commit8d33cddcb001a5a78aca036161d6223268274211 (patch)
tree6d6de3d4a96ffdf6a135d0a405e219c1643b9ec4
parentdff649f3e7e245c480ecdae06e53f4ffa2a592de (diff)
downloadsamba-8d33cddcb001a5a78aca036161d6223268274211.tar.gz
samba-8d33cddcb001a5a78aca036161d6223268274211.tar.xz
samba-8d33cddcb001a5a78aca036161d6223268274211.zip
ldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()
Searches for '(objectCategory=Person)' will leak a ldb_dn structure on the ldb_context. These searches are typically used by Zarafa. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10469 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Jul 17 00:51:57 CEST 2014 on sn-devel-104
-rw-r--r--lib/ldb-samba/ldif_handlers.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index 4425f86eb4..d9d799ccb8 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -483,8 +483,13 @@ static int ldif_canonicalise_objectCategory(struct ldb_context *ldb, void *mem_c
const char *lDAPDisplayName = talloc_strndup(tmp_ctx, (char *)in->data, in->length);
sclass = dsdb_class_by_lDAPDisplayName(schema, lDAPDisplayName);
if (sclass) {
- struct ldb_dn *dn = ldb_dn_new(mem_ctx, ldb,
+ struct ldb_dn *dn = ldb_dn_new(tmp_ctx, ldb,
sclass->defaultObjectCategory);
+ if (dn == NULL) {
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
*out = data_blob_string_const(ldb_dn_alloc_casefold(mem_ctx, dn));
talloc_free(tmp_ctx);