Alexandre Julliard : wldap32: Fix some potential infinite loops because of an unsigned loop counter.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 13 08:30:10 CDT 2007


Module: wine
Branch: master
Commit: 4397e9958534b24b72fb66b836426a5cf07c379b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4397e9958534b24b72fb66b836426a5cf07c379b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jul 12 17:32:24 2007 +0200

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 71dab84..a1cf79b 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 4a9aa37..1d1155b 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;
         } 




More information about the wine-cvs mailing list