diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-11-04 14:35:07 +0100 |
---|---|---|
committer | terriblephrases <terriblephrases@gmail.com> | 2018-12-16 02:18:16 +0100 |
commit | 539e145e65c5f1bf773c2e9cae1315e54d8055ce (patch) | |
tree | a6fd4cfbd7e42aa26f4a07cec0172853ab97e9d5 /x.c | |
parent | 62371f0b21965e029644b7ef2fbd00c81d56c665 (diff) |
fix memory leak in xloadcols()
reported by Avi Halachmi (:avih)" <avihpit@yahoo.com>
patch slightly changed by me.
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -760,12 +760,12 @@ xloadcols(void) static int loaded; Color *cp; - dc.collen = MAX(LEN(colorname), 256); - dc.col = xmalloc(dc.collen * sizeof(Color)); - if (loaded) { for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp) XftColorFree(xw.dpy, xw.vis, xw.cmap, cp); + } else { + dc.collen = MAX(LEN(colorname), 256); + dc.col = xmalloc(dc.collen * sizeof(Color)); } for (i = 0; i < dc.collen; i++) |