diff options
-rw-r--r-- | xorg/X11R7.6/rdp/rdp.h | 4 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpmain.c | 1 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdprandr.c | 9 |
3 files changed, 11 insertions, 3 deletions
diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 6fd7c38a..b2cbf449 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 a574f325..9e68f910 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -274,6 +274,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, |