Author: abartlet Date: 2007-11-16 04:18:22 +0000 (Fri, 16 Nov 2007) New Revision: 25981
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25981 Log: Don't create an ldb_request on NULL. A re-arrangment of the code due to the base DN checking meant that the ac->down_req array wasn't started, so was NULL Andrew Bartlett Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/linked_attributes.c Changeset: Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/linked_attributes.c =================================================================== --- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/linked_attributes.c 2007-11-15 23:40:46 UTC (rev 25980) +++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/linked_attributes.c 2007-11-16 04:18:22 UTC (rev 25981) @@ -127,8 +127,18 @@ for (j=0; j < el->num_values; j++) { struct ldb_message_element *ret_el; struct ldb_request *new_req; + struct ldb_message *new_msg; + + /* Create a spot in the list for the requests */ + ac->down_req = talloc_realloc(ac, ac->down_req, + struct ldb_request *, ac->num_requests + 1); + if (!ac->down_req) { + ldb_oom(ldb); + return LDB_ERR_OPERATIONS_ERROR; + } + /* Create the modify request */ - struct ldb_message *new_msg = ldb_msg_new(ac->down_req); + new_msg = ldb_msg_new(ac->down_req); if (!new_msg) { ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; @@ -184,13 +194,6 @@ ldb_set_timeout_from_prev_req(ldb, ac->orig_req, new_req); - /* Now add it to the list */ - ac->down_req = talloc_realloc(ac, ac->down_req, - struct ldb_request *, ac->num_requests + 1); - if (!ac->down_req) { - ldb_oom(ldb); - return LDB_ERR_OPERATIONS_ERROR; - } ac->down_req[ac->num_requests] = new_req; ac->num_requests++;