From: Daniil Sarafannikov Date: Thu, 25 Jun 2026 21:06:26 +0000 (+0400) Subject: s3:utils: Fix dereference of NULL ctx when memory is not allocated X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a27631198c8bbe23e79116456357d5c2efd18948;p=thirdparty%2Fsamba.git s3:utils: Fix dereference of NULL ctx when memory is not allocated In case talloc_zero returns NULL, we must return NULL from function check_ctx_create(). Otherwise, we dereference NULL pointer when accessing fields of ctx struct. Suggested-by: Anoop C S Signed-off-by: Daniil Sarafannikov Reviewed-by: Anoop C S Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Tue Jun 30 13:39:52 UTC 2026 on atb-devel-224 --- diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c index 52f4dab0722..aa5e65ecf81 100644 --- a/source3/utils/net_registry_check.c +++ b/source3/utils/net_registry_check.c @@ -293,6 +293,9 @@ static struct check_ctx* check_ctx_create(TALLOC_CTX *mem_ctx, const char *db, const struct check_options *opt) { struct check_ctx *ctx = talloc_zero(mem_ctx, struct check_ctx); + if (ctx == NULL) { + return NULL; + } ctx->opt = *opt; ctx->reg = db_open_rbt(ctx);