Hans Leidekker (@hans) commented about dlls/wldap32/control.c:
if (!ld || !control) return ~0u; if (info && !(infoU = vlvinfoWtoU( info ))) return WLDAP32_LDAP_NO_MEMORY;
- if ((ret = WLDAP32_ldap_connect( ld, NULL ))) return ret;
This can leak infoU on error. You can just move the call before the conversion. You missed ldap_create_sort_controlW() in this file.