winex11: Avoid memory leaks (coverity)

André Hentschel nerv at dawncrow.de
Sat Nov 3 11:25:45 CDT 2012


CID 731825 & 731826
---
 dlls/winex11.drv/clipboard.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index bd3ef7b..e2f5b12 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -1370,6 +1370,8 @@ static HANDLE X11DRV_CLIPBOARD_ImportXAPIXMAP(Display *display, Window w, Atom p
             }
             if (bits.free) bits.free( &bits );
         }
+
+        HeapFree(GetProcessHeap(), 0, lpdata);
     }
 
     return hClipData;
@@ -1489,7 +1491,10 @@ static HANDLE X11DRV_CLIPBOARD_ImportClipboardData(Display *display, Window w, A
             /* Turn on the DDESHARE flag to enable shared 32 bit memory */
             hClipData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cbytes);
             if (hClipData == 0)
+            {
+                HeapFree(GetProcessHeap(), 0, lpdata);
                 return NULL;
+            }
 
             if ((lpClipData = GlobalLock(hClipData)))
             {
-- 
1.8.0



-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list