From 4397e9958534b24b72fb66b836426a5cf07c379b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 12 Jul 2007 17:32:24 +0200 Subject: [PATCH] wldap32: Fix some potential infinite loops because of an unsigned loop counter. --- dlls/wldap32/init.c | 3 +-- dlls/wldap32/value.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c index 71dab849001..a1cf79beac1 100644 --- a/dlls/wldap32/init.c +++ b/dlls/wldap32/init.c @@ -109,8 +109,7 @@ static char **split_hostnames( const char *hostnames ) return res; oom: - for (--i; i >= 0; i--) - strfreeU( res[i] ); + while (i > 0) strfreeU( res[--i] ); HeapFree( GetProcessHeap(), 0, res ); HeapFree( GetProcessHeap(), 0, str ); diff --git a/dlls/wldap32/value.c b/dlls/wldap32/value.c index 4a9aa374da9..1d1155b846f 100644 --- a/dlls/wldap32/value.c +++ b/dlls/wldap32/value.c @@ -190,9 +190,7 @@ static char **bv2str_array( struct berval **bv ) str[i] = bv2str( *p ); if (!str[i]) { - for (--i; i >= 0; i--) - HeapFree( GetProcessHeap(), 0, str[i] ); - + while (i > 0) HeapFree( GetProcessHeap(), 0, str[--i] ); HeapFree( GetProcessHeap(), 0, str ); return NULL; }