From: Po Lu Date: Mon, 7 Mar 2022 11:53:52 +0000 (+0800) Subject: Fix color leak X-Git-Tag: emacs-29.0.90~1975 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f2b58db280e28b1ec1607520ef706482e14f6a57;p=emacs.git Fix color leak * src/xterm.c (x_alloc_nearest_color_1): Don't allocate colors multiple times when searching for a closest match. --- diff --git a/src/xterm.c b/src/xterm.c index 0432bd78c6e..1befa97fd14 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3882,12 +3882,8 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color) temp.red = cells[x].red; temp.green = cells[x].green; temp.blue = cells[x].blue; - status = XAllocColor (dpy, cmap, &temp); - if (status) - { - nearest = x; - nearest_delta = trial_delta; - } + nearest = x; + nearest_delta = trial_delta; } } color->red = cells[nearest].red;