From: Joseph Sutton Date: Mon, 16 Oct 2023 06:09:54 +0000 (+1300) Subject: s4:torture: Check return values of talloc functions X-Git-Tag: talloc-2.4.2~1232 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf30ddb56d25cb7980faf7196d63ca352f156dcc;p=thirdparty%2Fsamba.git s4:torture: Check return values of talloc functions Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/source4/torture/rpc/backupkey.c b/source4/torture/rpc/backupkey.c index 23572e82e57..8b7c6c30d10 100644 --- a/source4/torture/rpc/backupkey.c +++ b/source4/torture/rpc/backupkey.c @@ -264,15 +264,26 @@ static DATA_BLOB *create_access_check(struct torture_context *tctx, bool broken, uint32_t version) { - TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); - DATA_BLOB *blob = talloc_zero(mem_ctx, DATA_BLOB); + TALLOC_CTX *tmp_ctx = NULL; + DATA_BLOB *blob = NULL; enum ndr_err_code ndr_err; - const struct dom_sid *sid = get_user_sid(tctx, tmp_ctx, user); + const struct dom_sid *sid = NULL; + + tmp_ctx = talloc_new(mem_ctx); + if (tmp_ctx == NULL) { + return NULL; + } + sid = get_user_sid(tctx, tmp_ctx, user); if (sid == NULL) { return NULL; } + blob = talloc_zero(mem_ctx, DATA_BLOB); + if (blob == NULL) { + return NULL; + } + if (version == 2) { struct bkrp_access_check_v2 access_struct; gnutls_hash_hd_t dig_ctx;