]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix color leak
authorPo Lu <luangruo@yahoo.com>
Mon, 7 Mar 2022 11:53:52 +0000 (19:53 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 7 Mar 2022 11:53:52 +0000 (19:53 +0800)
* src/xterm.c (x_alloc_nearest_color_1): Don't allocate colors
multiple times when searching for a closest match.

src/xterm.c

index 0432bd78c6ea1ebabc2789c892c0185a71c25979..1befa97fd14bba95e0a9610f4ce98a0fa53749e7 100644 (file)
@@ -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;