msvcrt: fix potential memory leak (found by Smatch).

Lionel Debroux lionel_debroux at yahoo.fr
Mon Sep 24 06:51:58 CDT 2007


---
 dlls/msvcrt/dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c
index 6050251..51dc50e 100644
--- a/dlls/msvcrt/dir.c
+++ b/dlls/msvcrt/dir.c
@@ -449,7 +449,7 @@ MSVCRT_wchar_t* CDECL _wgetcwd(MSVCRT_wchar_t * buf, int size)
       if (size <= dir_len) size = dir_len + 1;
       if (!(buf = MSVCRT_malloc( size * sizeof(WCHAR) ))) return NULL;
   }
-  if (dir_len >= size)
+  else if (dir_len >= size)
   {
     *MSVCRT__errno() = MSVCRT_ERANGE;
     return NULL; /* buf too small */
-- 
1.5.3.1


--------------060103010403000509000001--



More information about the wine-patches mailing list