mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-22 07:15:59 +01:00
fix memory leak in xloadcols()
reported by Avi Halachmi (:avih)" <avihpit@yahoo.com> patch slightly changed by me.
This commit is contained in:
parent
62371f0b21
commit
539e145e65
1 changed files with 3 additions and 3 deletions
6
x.c
6
x.c
|
@ -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++)
|
||||
|
|
Loading…
Reference in a new issue