r15571: Fix Coverity bug #285
authorVolker Lendecke <vlendec@samba.org>
Sat, 13 May 2006 17:28:21 +0000 (17:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:02 +0000 (11:17 -0500)
(This used to be commit 2cf503d7da08319f318217f6fe8f85c18bf0dffb)

source3/passdb/pdb_ldap.c

index 24fcd7b39f67c952bd8dc1f61beaa86a710a3bf0..93862937935fb8adb6319c2034bcf7a6ad677861 100644 (file)
@@ -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" */