mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Plug two memory leaks. Also get rid of a variable that is no longer
necessary. OK okan@
This commit is contained in:
parent
3d1a8028c2
commit
d8c7d87737
16
client.c
16
client.c
@ -668,21 +668,23 @@ void
|
|||||||
client_set_name(struct client_ctx *cc)
|
client_set_name(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
struct winname *wn;
|
struct winname *wn;
|
||||||
char *newname;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (!xu_get_strprop(cc->win, ewmh[_NET_WM_NAME], &newname))
|
free(cc->name);
|
||||||
if (!xu_get_strprop(cc->win, XA_WM_NAME, &newname))
|
if (!xu_get_strprop(cc->win, ewmh[_NET_WM_NAME], &cc->name))
|
||||||
newname = xstrdup("");
|
if (!xu_get_strprop(cc->win, XA_WM_NAME, &cc->name))
|
||||||
|
cc->name = xstrdup("");
|
||||||
|
|
||||||
TAILQ_FOREACH(wn, &cc->nameq, entry) {
|
TAILQ_FOREACH(wn, &cc->nameq, entry) {
|
||||||
if (strcmp(wn->name, newname) == 0)
|
if (strcmp(wn->name, cc->name) == 0) {
|
||||||
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
||||||
|
free(wn->name);
|
||||||
|
free(wn);
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
cc->name = newname;
|
|
||||||
wn = xmalloc(sizeof(*wn));
|
wn = xmalloc(sizeof(*wn));
|
||||||
wn->name = xstrdup(newname);
|
wn->name = xstrdup(cc->name);
|
||||||
TAILQ_INSERT_TAIL(&cc->nameq, wn, entry);
|
TAILQ_INSERT_TAIL(&cc->nameq, wn, entry);
|
||||||
|
|
||||||
/* Garbage collection. */
|
/* Garbage collection. */
|
||||||
|
Loading…
Reference in New Issue
Block a user