Commit 89f1d626 authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

wldap32: Set error code in error cases (Coverity).

parent 0408d3a8
......@@ -218,13 +218,19 @@ WCHAR * CDECL ldap_first_attributeW( LDAP *ld, WLDAP32_LDAPMessage *entry, WLDAP
if (ld && entry) retU = ldap_first_attribute( CTX(ld), MSG(entry), &berU );
else return NULL;
if (retU && (ber = malloc( sizeof(*ber) )))
if (!retU)
return NULL;
if (!(ber = malloc( sizeof(*ber) )))
{
ber->opaque = (char *)berU;
*ptr = ber;
ret = strUtoW( retU );
ld->ld_errno = WLDAP32_LDAP_NO_MEMORY;
ldap_memfree( retU );
return NULL;
}
ber->opaque = (char *)berU;
*ptr = ber;
ret = strUtoW( retU );
ldap_memfree( retU );
return ret;
}
......@@ -358,12 +364,18 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_entry( LDAP *ld, WLDAP32_LDAPMessa
if (entry->lm_next) return entry->lm_next;
msgU = ldap_next_entry( CTX(ld), MSG(entry) );
if (msgU && (msg = calloc( 1, sizeof(*msg) )))
if (!msgU)
return NULL;
if (!(msg = calloc( 1, sizeof(*msg) )))
{
MSG(msg) = msgU;
entry->lm_next = msg;
ld->ld_errno = WLDAP32_LDAP_NO_MEMORY;
return NULL;
}
MSG(msg) = msgU;
entry->lm_next = msg;
return msg;
}
......@@ -382,12 +394,18 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_reference( LDAP *ld, WLDAP32_LDAPM
if (entry->lm_next) return entry->lm_next;
msgU = ldap_next_reference( CTX(ld), MSG(entry) );
if (msgU && (msg = calloc( 1, sizeof(*msg) )))
if (!msgU)
return NULL;
if (!(msg = calloc( 1, sizeof(*msg) )))
{
MSG(msg) = msgU;
entry->lm_next = msg;
ld->ld_errno = WLDAP32_LDAP_NO_MEMORY;
return NULL;
}
MSG(msg) = msgU;
entry->lm_next = msg;
return msg;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment