During a wildcard match, even against a case sensitive or binary object, memory is allocated for each and every candidate match in ldb_wildcard_compare().
This bug was referenced in samba master: cad96f59a08192df927fb1df4e9787c7f70991a2
This bug was referenced in samba v4-16-stable (Release samba-4.16.10): ae3d2737949d9702c5526490c2155740a96a9adb
This bug was referenced in samba v4-17-stable (Release samba-4.17.7): eb20778b5e66c4e011c9c264ddb8d29180fe6e89
This bug was referenced in samba v4-18-stable (Release samba-4.18.1): 680b865f183d3103cd7d465e6b921fb5f28627b8
This bug was referenced in samba v4-16-test: ae3d2737949d9702c5526490c2155740a96a9adb
This bug was referenced in samba v4-17-test: eb20778b5e66c4e011c9c264ddb8d29180fe6e89
This bug was referenced in samba v4-18-test: 680b865f183d3103cd7d465e6b921fb5f28627b8