Alex Henrie (@alexhenrie) commented about dlls/wldap32/misc.c:
ret = ldap_result( CTX(ld), msgid, all, timeout ? &timeval : NULL, &msgU ); } - if (msgU && (msg = calloc( 1, sizeof(*msg) ))) + if (msgU) { - MSG(msg) = msgU; - *res = msg; + if ((msg = calloc( 1, sizeof(*msg) ))) + { + MSG(msg) = msgU; + *res = msg; + } + else + free (msgU);
Please use a consistent style here, namely `free( msgU )` instead of `free (msgU)`. Also, shouldn't this function return WLDAP32_LDAP_NO_MEMORY if calloc fails? I think the most clear way to handle the errors would be: ``` if (!msgU) return ret; if (!(msg = calloc( 1, sizeof(*msg) ))) { free( msgU ); return WLDAP32_LDAP_NO_MEMORY; } MSG(msg) = msgU; *res = msg; return ret; ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1774#note_19421