Win32 driver: Fix memory leak / invalid pointer to free() when re-calculating buffer position in a specific situation.
Thanks to @nathanwiebe for reporting this.
This commit is contained in:
parent
1235a9056c
commit
7845f44f20
@ -19,6 +19,7 @@ FEATURE: STM32LTDC driver: Support double buffering. This introduces STM32LTD
|
||||
FIX: STM32LTDC driver: Fix bug in gdisp_lld_blit_area() which affected blits with source coordinates other than (0, 0).
|
||||
FIX: Improve /demos/benchmarks/rectangles.
|
||||
FIX: Win32 driver: Fix buffer position calculation in gdisp_lld_blit_area().
|
||||
FIX: Win32 driver: Fix memory leak / invalid pointer to free() when re-calculating buffer position in a specific situation.
|
||||
|
||||
|
||||
*** Release 2.9 ***
|
||||
|
@ -1279,11 +1279,17 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
||||
gPixel * buffer;
|
||||
RECT rect;
|
||||
BITMAPV4HEADER bmpInfo;
|
||||
#if GDISP_NEED_CONTROL
|
||||
gPixel* bufferBase;
|
||||
#endif
|
||||
|
||||
// Make everything relative to the start of the line
|
||||
priv = g->priv;
|
||||
buffer = g->p.ptr;
|
||||
buffer += g->p.x2 * g->p.y1 + g->p.x1;
|
||||
#if GDISP_NEED_CONTROL
|
||||
bufferBase = buffer; // Keep pointer to original buffer for correct free()-ing later on
|
||||
#endif
|
||||
|
||||
memset(&bmpInfo, 0, sizeof(bmpInfo));
|
||||
bmpInfo.bV4Size = sizeof(bmpInfo);
|
||||
@ -1369,7 +1375,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
||||
#endif
|
||||
|
||||
#if GDISP_NEED_CONTROL
|
||||
if (buffer != (gPixel *)g->p.ptr)
|
||||
if (bufferBase != buffer)
|
||||
free(buffer);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user