1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ldb-samba:ldif_handlers: dn_link_comparison leaks less

dn1 and dn2 can be invalid but still occupying memory.
(ldb_dn_validate(dn2) does contain a NULL check, but a lot more besides).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2024-04-11 16:59:50 +12:00 committed by Andrew Bartlett
parent 7035659256
commit 341b8fb60e

View File

@ -1182,12 +1182,14 @@ static int samba_ldb_dn_link_comparison(struct ldb_context *ldb, void *mem_ctx,
dn1 = ldb_dn_from_ldb_val(mem_ctx, ldb, v1);
if ( ! ldb_dn_validate(dn1)) {
TALLOC_FREE(dn1);
return 1;
}
dn2 = ldb_dn_from_ldb_val(mem_ctx, ldb, v2);
if ( ! ldb_dn_validate(dn2)) {
talloc_free(dn1);
TALLOC_FREE(dn1);
TALLOC_FREE(dn2);
return -1;
}