1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

gensec: Simplify gensec_security_by_fn()

We don't need that intermediate talloc ctx, we only allocate backends
and don't pass it anywhere else.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Volker Lendecke 2024-05-29 17:11:51 +02:00
parent 82c477b980
commit 5c736ffe35

View File

@ -192,16 +192,9 @@ static const struct gensec_security_ops *gensec_security_by_fn(
{
size_t i;
const struct gensec_security_ops **backends = NULL;
TALLOC_CTX *mem_ctx = NULL;
mem_ctx = talloc_new(gensec_security);
if (!mem_ctx) {
return NULL;
}
backends = gensec_security_mechs(gensec_security, mem_ctx);
backends = gensec_security_mechs(gensec_security, gensec_security);
if (backends == NULL) {
TALLOC_FREE(mem_ctx);
return NULL;
}
@ -211,12 +204,12 @@ static const struct gensec_security_ops *gensec_security_by_fn(
ok = fn(backend, private_data);
if (ok) {
TALLOC_FREE(mem_ctx);
TALLOC_FREE(backends);
return backend;
}
}
TALLOC_FREE(mem_ctx);
TALLOC_FREE(backends);
return NULL;
}