Module: wine Branch: master Commit: 08d49d3e335acb5f9188af827265b955ca430d7b URL: http://source.winehq.org/git/wine.git/?a=commit;h=08d49d3e335acb5f9188af8272...
Author: Nathan Beckmann nathan.beckmann@gmail.com Date: Fri Mar 7 01:19:03 2008 -0800
gdiplus: Fix memory leak in GdipLockBitmapBits.
---
dlls/gdiplus/image.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 7009197..6b827ba 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -170,8 +170,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect, bitmap->lockmode = flags; bitmap->numlocks++;
- if(flags & ImageLockModeWrite) - bitmap->bitmapbits = buff; + bitmap->bitmapbits = buff;
return Ok; } @@ -198,7 +197,8 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, if(!(--bitmap->numlocks)) bitmap->lockmode = 0;
- GdipFree(lockeddata->Scan0); + GdipFree(bitmap->bitmapbits); + bitmap->bitmapbits = NULL; return Ok; }
@@ -225,6 +225,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, }
GdipFree(bitmap->bitmapbits); + bitmap->bitmapbits = NULL;
return Ok; } @@ -426,6 +427,8 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image) IPicture_get_CurDC(image->picture, &hdc); DeleteDC(hdc); IPicture_Release(image->picture); + if (image->type == ImageTypeBitmap) + GdipFree(((GpBitmap*)image)->bitmapbits); GdipFree(image);
return Ok;