Module: wine Branch: refs/heads/master Commit: 1bf5e2da0ac53d85bae49cc43dfbcf981e229433 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=1bf5e2da0ac53d85bae49cc4...
Author: Hans Leidekker hans@it.vu.nl Date: Sat Apr 8 16:11:42 2006 +0200
wldap32: Fix broken parameter handling.
---
dlls/wldap32/control.c | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/dlls/wldap32/control.c b/dlls/wldap32/control.c index 5c4b413..b8b5963 100644 --- a/dlls/wldap32/control.c +++ b/dlls/wldap32/control.c @@ -214,16 +214,20 @@ INT ldap_create_vlv_controlA( WLDAP32_LD { INT ret = LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP - LDAPControlW **controlW = NULL; + LDAPControlW *controlW = NULL;
TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control );
- if (!ld) return ~0UL; + if (!ld || !control) return ~0UL;
- ret = ldap_create_vlv_controlW( ld, info, critical, controlW ); + ret = ldap_create_vlv_controlW( ld, info, critical, &controlW );
- *control = controlWtoA( *controlW ); - ldap_control_freeW( *controlW ); + if (ret == LDAP_SUCCESS) + { + *control = controlWtoA( controlW ); + if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; + ldap_control_freeW( controlW ); + }
#endif return ret; @@ -256,16 +260,20 @@ INT ldap_create_vlv_controlW( WLDAP32_LD { INT ret = LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP - LDAPControl **controlU = NULL; + LDAPControl *controlU = NULL;
TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control );
- if (!ld) return ~0UL; + if (!ld || !control) return ~0UL;
- ret = ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, controlU ); + ret = ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, &controlU );
- *control = controlUtoW( *controlU ); - ldap_control_free( *controlU ); + if (ret == LDAP_SUCCESS) + { + *control = controlUtoW( controlU ); + if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; + ldap_control_free( controlU ); + }
#endif return ret;