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:
parent
82c477b980
commit
5c736ffe35
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user