On Mon Dec 12 02:53:32 2022 +0000, Alex Henrie wrote:
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;
Fixed the style issue.\ I didn't want to change the behavior, only fix the potential memory leak. There's a few other functions that also use calloc/malloc, they have the same behavior if allocation fails. If we change that here, we should probably adjust those as well.\ Do you want me to add those changes into this MR?