From d8670cb4de2ab9bb02b987bb047b821e2e8def1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Wed, 27 Aug 2003 08:21:53 +0000 Subject: [PATCH] Fixed memory leak with colormap allocation. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@447 423420c4-83ab-492f-b58f-81f9feb106b5 --- xwin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xwin.c b/xwin.c index 73012f2..639a004 100644 --- a/xwin.c +++ b/xwin.c @@ -103,7 +103,7 @@ PixelColour; /* colour maps */ BOOL owncolmap = False; static Colormap xcolmap; -static uint32 *colmap; +static uint32 *colmap = NULL; #define TRANSLATE(col) ( g_server_bpp != 8 ? translate_colour(col) : owncolmap ? col : translate_colour(colmap[col]) ) #define SET_FOREGROUND(col) XSetForeground(display, gc, TRANSLATE(col)); @@ -600,7 +600,8 @@ ui_init(void) if (ownbackstore) { backstore = - XCreatePixmap(display, RootWindowOfScreen(screen), g_width, g_height, depth); + XCreatePixmap(display, RootWindowOfScreen(screen), g_width, g_height, + depth); /* clear to prevent rubbish being exposed at startup */ XSetForeground(display, gc, BlackPixelOfScreen(screen)); @@ -1347,7 +1348,12 @@ void ui_set_colourmap(HCOLOURMAP map) { if (!owncolmap) + { + if (colmap) + xfree(colmap); + colmap = (uint32 *) map; + } else XSetWindowColormap(display, wnd, (Colormap) map); }