Nikolay Sivov : riched20: Fix a memory leak on error path (Coverity).

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 11 08:36:43 CST 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Nov 10 23:07:58 2015 +0300

riched20: Fix a memory leak on error path (Coverity).

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/editor.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index bbb0cc0..28c845c 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1268,12 +1268,10 @@ static void ME_RTFReadShpPictGroup( RTF_Info *info )
 static DWORD read_hex_data( RTF_Info *info, BYTE **out )
 {
     DWORD read = 0, size = 1024;
-    BYTE *buf = HeapAlloc( GetProcessHeap(), 0, size );
-    BYTE val;
+    BYTE *buf, val;
     BOOL flip;
 
     *out = NULL;
-    if (!buf) return 0;
 
     if (info->rtfClass != rtfText)
     {
@@ -1281,6 +1279,9 @@ static DWORD read_hex_data( RTF_Info *info, BYTE **out )
         return 0;
     }
 
+    buf = HeapAlloc( GetProcessHeap(), 0, size );
+    if (!buf) return 0;
+
     val = info->rtfMajor;
     for (flip = TRUE;; flip = !flip)
     {




More information about the wine-cvs mailing list