=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: user32: Avoid memory leaks (coverity ).

Alexandre Julliard julliard at winehq.org
Tue Oct 30 13:27:36 CDT 2012


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

Author: André Hentschel <nerv at dawncrow.de>
Date:   Tue Oct 30 15:03:05 2012 +0100

user32: Avoid memory leaks (coverity).

---

 dlls/user32/message.c |    6 +++++-
 dlls/user32/text.c    |    9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index b934705..6d45671 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -2903,7 +2903,11 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
                     handle_internal_message( info.msg.hwnd, info.msg.message,
                                              info.msg.wParam, info.msg.lParam );
                     /* if this is a nested call return right away */
-                    if (first == info.msg.message && last == info.msg.message) return FALSE;
+                    if (first == info.msg.message && last == info.msg.message)
+                    {
+                        HeapFree( GetProcessHeap(), 0, buffer );
+                        return FALSE;
+                    }
                 }
                 else
                     peek_message( msg, info.msg.hwnd, info.msg.message,
diff --git a/dlls/user32/text.c b/dlls/user32/text.c
index 8539bdf..20f7798 100644
--- a/dlls/user32/text.c
+++ b/dlls/user32/text.c
@@ -985,7 +985,10 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
                     p = str; while (p < str+len && *p != TAB) p++;
                     len_seg = p - str;
                     if (len_seg != len && !GetTextExtentPointW(hdc, str, len_seg, &size))
+                    {
+                        HeapFree (GetProcessHeap(), 0, retstr);
                         return 0;
+                    }
                 }
                 else
                     len_seg = len;
@@ -993,7 +996,11 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
                 if (!ExtTextOutW( hdc, xseg, y,
                                  ((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |
                                  ((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
-                                 rect, str, len_seg, NULL ))  return 0;
+                                 rect, str, len_seg, NULL ))
+                {
+                    HeapFree (GetProcessHeap(), 0, retstr);
+                    return 0;
+                }
                 if (prefix_offset != -1 && prefix_offset < len_seg)
                 {
                     TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 1, str, prefix_offset, (flags & DT_NOCLIP) ? NULL : rect);




More information about the wine-cvs mailing list