From: Douglas Bagnall Date: Wed, 9 Jan 2019 04:55:38 +0000 (+1300) Subject: dsdb: linked attrs: check a talloc_new() X-Git-Url: http://git.samba.org/?a=commitdiff_plain;ds=sidebyside;h=a086a6457b421c36562275a425ce2bbd32336f8f;p=metze%2Fsamba%2Fwip.git dsdb: linked attrs: check a talloc_new() Also we can defer it past a thing that doesn't need or check for it. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c index 2568d4d17900..816968584b52 100644 --- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c +++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c @@ -695,7 +695,7 @@ static int linked_attributes_fix_links(struct ldb_module *module, struct ldb_request *parent) { unsigned int i, j; - TALLOC_CTX *tmp_ctx = talloc_new(module); + TALLOC_CTX *tmp_ctx = NULL; struct ldb_context *ldb = ldb_module_get_ctx(module); const struct dsdb_attribute *target; const char *attrs[2]; @@ -707,6 +707,11 @@ static int linked_attributes_fix_links(struct ldb_module *module, return LDB_SUCCESS; } + tmp_ctx = talloc_new(module); + if (tmp_ctx == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + attrs[0] = target->lDAPDisplayName; attrs[1] = NULL;