[PATCH] riched20: Fix a memory leak on error path (Coverity)
Nikolay Sivov
nsivov at codeweavers.com
Tue Nov 10 14:07:58 CST 2015
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
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)
{
--
2.6.2
More information about the wine-patches
mailing list