gdi32: Avoid memory leaks (coverity)

André Hentschel nerv at dawncrow.de
Sun Oct 28 10:16:37 CDT 2012


CID 713453 & 713454 & 713455  &  713461 & 713462 & 713463
---
 dlls/gdi32/bidi.c         | 3 +++
 dlls/gdi32/tests/bitmap.c | 3 ++-
 dlls/gdi32/tests/dib.c    | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/bidi.c b/dlls/gdi32/bidi.c
index 0354996..00dce45 100644
--- a/dlls/gdi32/bidi.c
+++ b/dlls/gdi32/bidi.c
@@ -545,6 +545,9 @@ BOOL BIDI_Reorder(
                 WARN("Out of memory\n");
                 HeapFree(GetProcessHeap(), 0, chartype);
                 HeapFree(GetProcessHeap(), 0, levels);
+                HeapFree(GetProcessHeap(), 0, run_glyphs);
+                HeapFree(GetProcessHeap(), 0, pwLogClust);
+                HeapFree(GetProcessHeap(), 0, psva);
                 return FALSE;
             }
             res = ScriptItemize(lpString + done, i, maxItems, &Control, &State, pItems, &nItems);
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 04c93c1..f72574a 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -3741,7 +3741,7 @@ static void test_GdiAlphaBlend(void)
     DeleteObject(bmpDst);
 
     ReleaseDC(NULL, hdcNull);
-
+    HeapFree(GetProcessHeap(), 0, bmi);
 }
 
 static void test_GdiGradientFill(void)
@@ -3854,6 +3854,7 @@ static void test_GdiGradientFill(void)
 
     DeleteDC( hdc );
     DeleteObject( bmp );
+    HeapFree(GetProcessHeap(), 0, bmi);
 }
 
 static void test_clipping(void)
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c
index f4ed8e1..18c1067 100644
--- a/dlls/gdi32/tests/dib.c
+++ b/dlls/gdi32/tests/dib.c
@@ -1308,6 +1308,7 @@ static void compare_hash_broken_todo(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const
         if(current_sha1[i] == NULL)
         {
             ok(current_sha1[i] != NULL, "missing hash, got \"%s\",\n", hash);
+            HeapFree(GetProcessHeap(), 0, hash);
             return;
         }
     }
-- 
1.8.0



-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list