aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-03-07 19:53:52 +0800
committerPo Lu2022-03-07 19:53:52 +0800
commitf2b58db280e28b1ec1607520ef706482e14f6a57 (patch)
treecd8f9184d18f12da1d4444440187bf745e32cc38 /src
parent8b66adfe065e0f21ec99c88e3cbb1cb16a94c6cd (diff)
downloademacs-f2b58db280e28b1ec1607520ef706482e14f6a57.tar.gz
emacs-f2b58db280e28b1ec1607520ef706482e14f6a57.zip
Fix color leak
* src/xterm.c (x_alloc_nearest_color_1): Don't allocate colors multiple times when searching for a closest match.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c8
1 files changed, 2 insertions, 6 deletions
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)
3882 temp.red = cells[x].red; 3882 temp.red = cells[x].red;
3883 temp.green = cells[x].green; 3883 temp.green = cells[x].green;
3884 temp.blue = cells[x].blue; 3884 temp.blue = cells[x].blue;
3885 status = XAllocColor (dpy, cmap, &temp); 3885 nearest = x;
3886 if (status) 3886 nearest_delta = trial_delta;
3887 {
3888 nearest = x;
3889 nearest_delta = trial_delta;
3890 }
3891 } 3887 }
3892 } 3888 }
3893 color->red = cells[nearest].red; 3889 color->red = cells[nearest].red;