diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 22dcdbf7..b9c02353 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -114,7 +114,9 @@ struct _rdpScreenInfoRec int height; int depth; int bitsPerPixel; - int sizeInBytes; + int sizeInBytes; /* size of current used frame buffer */ + int sizeInBytesAlloc; /* size of current alloc frame buffer, + always >= sizeInBytes */ char* pfbMemory; Pixel blackPixel; Pixel whitePixel; diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c index b2cbf771..f81b4f70 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -272,6 +272,7 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) (g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height); ErrorF("buffer size %d\n", g_rdpScreen.sizeInBytes); g_rdpScreen.pfbMemory = (char *)g_malloc(g_rdpScreen.sizeInBytes, 1); + g_rdpScreen.sizeInBytesAlloc = g_rdpScreen.sizeInBytes; } if (g_rdpScreen.pfbMemory == 0) diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c index 26b56bfe..8b3eb582 100644 --- a/xorg/X11R7.6/rdp/rdprandr.c +++ b/xorg/X11R7.6/rdp/rdprandr.c @@ -156,8 +156,13 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, ErrorF(" resizing screenPixmap [%p] to %dx%d, currently at %dx%d\n", (void *)screenPixmap, width, height, screenPixmap->drawable.width, screenPixmap->drawable.height); - g_free(g_rdpScreen.pfbMemory); - g_rdpScreen.pfbMemory = g_malloc(g_rdpScreen.sizeInBytes, 1); + if (g_rdpScreen.sizeInBytes > g_rdpScreen.sizeInBytesAlloc) + { + g_free(g_rdpScreen.pfbMemory); + g_rdpScreen.pfbMemory = (char*)g_malloc(g_rdpScreen.sizeInBytes, 1); + g_rdpScreen.sizeInBytesAlloc = g_rdpScreen.sizeInBytes; + ErrorF("new buffer size %d\n", g_rdpScreen.sizeInBytes); + } pScreen->ModifyPixmapHeader(screenPixmap, width, height, g_rdpScreen.depth, g_rdpScreen.bitsPerPixel, g_rdpScreen.paddedWidthInBytes,