The "rec" variable is allocated within the long-lived LDB memory
context, meaning it persists until the module is unloaded.
Previously, this resource was only freed upon the successful
execution of ldb_dn_compare().
If ldb_dn_compare fails, the allocated memory is leaked. This patch
ensures that the memory is properly released regardless of the
function's return status.
Signed-off-by: Petr Usoltsev <usoltsevpv@basealt.ru>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Jul 14 06:18:36 UTC 2026 on atb-devel-224
TALLOC_FREE(rec);
break;
}
+ TALLOC_FREE(rec);
}
/*
TALLOC_FREE(list);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
+ TALLOC_FREE(rec);
}
}