summaryrefslogtreecommitdiff
path: root/src/xterm.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-03-07 19:53:52 +0800
committerPo Lu <luangruo@yahoo.com>2022-03-07 19:53:52 +0800
commitf2b58db280e28b1ec1607520ef706482e14f6a57 (patch)
treecd8f9184d18f12da1d4444440187bf745e32cc38 /src/xterm.c
parent8b66adfe065e0f21ec99c88e3cbb1cb16a94c6cd (diff)
downloademacs-f2b58db280e28b1ec1607520ef706482e14f6a57.tar.gz
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/xterm.c')
-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)
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;