Commit 08d49d3e authored by Nathan Beckmann's avatar Nathan Beckmann Committed by Alexandre Julliard

gdiplus: Fix memory leak in GdipLockBitmapBits.

parent 738e74a1
...@@ -170,8 +170,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect, ...@@ -170,8 +170,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
bitmap->lockmode = flags; bitmap->lockmode = flags;
bitmap->numlocks++; bitmap->numlocks++;
if(flags & ImageLockModeWrite) bitmap->bitmapbits = buff;
bitmap->bitmapbits = buff;
return Ok; return Ok;
} }
...@@ -198,7 +197,8 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, ...@@ -198,7 +197,8 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
if(!(--bitmap->numlocks)) if(!(--bitmap->numlocks))
bitmap->lockmode = 0; bitmap->lockmode = 0;
GdipFree(lockeddata->Scan0); GdipFree(bitmap->bitmapbits);
bitmap->bitmapbits = NULL;
return Ok; return Ok;
} }
...@@ -225,6 +225,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, ...@@ -225,6 +225,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
} }
GdipFree(bitmap->bitmapbits); GdipFree(bitmap->bitmapbits);
bitmap->bitmapbits = NULL;
return Ok; return Ok;
} }
...@@ -426,6 +427,8 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image) ...@@ -426,6 +427,8 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
IPicture_get_CurDC(image->picture, &hdc); IPicture_get_CurDC(image->picture, &hdc);
DeleteDC(hdc); DeleteDC(hdc);
IPicture_Release(image->picture); IPicture_Release(image->picture);
if (image->type == ImageTypeBitmap)
GdipFree(((GpBitmap*)image)->bitmapbits);
GdipFree(image); GdipFree(image);
return Ok; return Ok;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment