ldb_ldap: trust db_msg_new() to return empty message
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sat, 6 Apr 2019 22:12:02 +0000 (10:12 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 May 2019 01:15:18 +0000 (01:15 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ldb_ldap/ldb_ldap.c

index 29f8938..484b810 100644 (file)
@@ -492,7 +492,7 @@ static bool lldb_parse_result(struct lldb_context *ac, LDAPMessage *result)
        char *errmsgp = NULL;
        LDAPMessage *msg;
        int type;
-       struct ldb_message *ldbmsg;
+       struct ldb_message *ldbmsg = NULL;
        char *referral;
        bool callback_failed;
        bool request_done;
@@ -537,10 +537,6 @@ static bool lldb_parse_result(struct lldb_context *ac, LDAPMessage *result)
                                break;
                        }
                        ldap_memfree(dn);
-
-                       ldbmsg->num_elements = 0;
-                       ldbmsg->elements = NULL;
-
                        /* loop over all attributes */
                        for (attr=ldap_first_attribute(lldb->ldap, msg, &berptr);
                             attr;