Module: wine Branch: master Commit: 0408d3a800137f00812a21004b54689fda34e016 URL: https://gitlab.winehq.org/wine/wine/-/commit/0408d3a800137f00812a21004b54689...
Author: Fabian Maurer dark.shadow4@web.de Date: Sun Dec 11 20:43:09 2022 +0100
wldap32: Free resource in error case and return error code (Coverity).
Signed-off-by: Fabian Maurer dark.shadow4@web.de
---
dlls/wldap32/misc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/wldap32/misc.c b/dlls/wldap32/misc.c index edf1f196353..a8d27a87b78 100644 --- a/dlls/wldap32/misc.c +++ b/dlls/wldap32/misc.c @@ -413,12 +413,18 @@ ULONG CDECL WLDAP32_ldap_result( LDAP *ld, ULONG msgid, ULONG all, struct l_time
ret = ldap_result( CTX(ld), msgid, all, timeout ? &timeval : NULL, &msgU ); } - if (msgU && (msg = calloc( 1, sizeof(*msg) ))) + + if (!msgU) + return ret; + + if (!(msg = calloc( 1, sizeof(*msg) ))) { - MSG(msg) = msgU; - *res = msg; + free( msgU ); + return WLDAP32_LDAP_NO_MEMORY; }
+ MSG(msg) = msgU; + *res = msg; return ret; }