wininet: Fix typo in comparision with NULL. Found by Smatch.

Michael Stefaniuc mstefani at redhat.de
Fri Dec 28 18:04:58 CST 2007


The code only worked by chance as the HeapReAlloc was used to decrease
the allocated memory and in that case HeapReAlloc doesn't seem to move
the memory around.

The failure case (NULL == tmpafp) doesn't need any handling as *lpafp
remains valid. There is no memory leaked; only the memory usage is a
little bit higher.
---
 dlls/wininet/ftp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index ed3fbea..27d3b43 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -3462,7 +3462,7 @@ static BOOL FTP_ParseDirectory(LPWININETFTPSESSIONW lpwfs, INT nSocket, LPCWSTR
 
             tmpafp = HeapReAlloc(GetProcessHeap(), 0, *lpafp,
                 sizeof(FILEPROPERTIESW)*indexFilePropArray);
-            if (NULL == tmpafp)
+            if (NULL != tmpafp)
                 *lpafp = tmpafp;
         }
         *dwfp = indexFilePropArray;
-- 
1.5.3.6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20071229/cf94fa28/attachment.pgp 


More information about the wine-patches mailing list