[PATCH] jsproxy: avoid potential NULL dereference (Coverity)

Marcus Meissner marcus at jet.franken.de
Tue May 20 01:47:38 CDT 2014


1214472 Dereference after null check
---
 dlls/jsproxy/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/jsproxy/main.c b/dlls/jsproxy/main.c
index 4d02b07..c6c6647 100644
--- a/dlls/jsproxy/main.c
+++ b/dlls/jsproxy/main.c
@@ -103,8 +103,10 @@ static inline WCHAR *strdupAW( const char *src, DWORD len )
     if (src)
     {
         int dst_len = MultiByteToWideChar( CP_ACP, 0, src, len, NULL, 0 );
-        if ((dst = heap_alloc( (dst_len + 1) * sizeof(WCHAR) ))) len = MultiByteToWideChar( CP_ACP, 0, src, len, dst, dst_len );
-        dst[dst_len] = 0;
+        if ((dst = heap_alloc( (dst_len + 1) * sizeof(WCHAR) ))) {
+            len = MultiByteToWideChar( CP_ACP, 0, src, len, dst, dst_len );
+            dst[dst_len] = 0;
+        }
     }
     return dst;
 }
-- 
1.8.4.5




More information about the wine-patches mailing list