From 91828b893d0fcae07e5678d03ef85811cf7c9c22 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 13 May 2006 17:28:21 +0000 Subject: r15571: Fix Coverity bug #285 (This used to be commit 2cf503d7da08319f318217f6fe8f85c18bf0dffb) --- source3/passdb/pdb_ldap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 24fcd7b39f..9386293793 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -4356,6 +4356,7 @@ static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv, char *value; int rc; uint32 nextRid = 0; + const char *dn; TALLOC_CTX *mem_ctx; @@ -4419,9 +4420,12 @@ static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv, talloc_asprintf(mem_ctx, "%d", nextRid)); talloc_autofree_ldapmod(mem_ctx, mods); - rc = smbldap_modify(smbldap_state, - smbldap_talloc_dn(mem_ctx, priv2ld(priv), entry), - mods); + if ((dn = smbldap_talloc_dn(mem_ctx, priv2ld(priv), entry)) == NULL) { + status = NT_STATUS_NO_MEMORY; + goto done; + } + + rc = smbldap_modify(smbldap_state, dn, mods); /* ACCESS_DENIED is used as a placeholder for "the modify failed, * please retry" */ -- cgit