summaryrefslogtreecommitdiff
path: root/app/cwm
diff options
context:
space:
mode:
authorTim van der Molen <tim@cvs.openbsd.org>2020-03-14 16:11:10 +0000
committerTim van der Molen <tim@cvs.openbsd.org>2020-03-14 16:11:10 +0000
commit21082ae1092e9a348bc586f4db869d29cd1dad0f (patch)
treee6a033788a3d8542a79a6aef2f881a250d63f2f0 /app/cwm
parentc4b9c50ebb616249cc8a6eb2e9e5fbbb8a1db7ba (diff)
Revert previous. Causes a crash as reported by Tom Murphy.
Diffstat (limited to 'app/cwm')
-rw-r--r--app/cwm/client.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/app/cwm/client.c b/app/cwm/client.c
index 1fd7fe74c..696b2e6fd 100644
--- a/app/cwm/client.c
+++ b/app/cwm/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.259 2020/03/13 20:49:13 tim Exp $
+ * $OpenBSD: client.c,v 1.260 2020/03/14 16:11:09 tim Exp $
*/
#include <sys/types.h>
@@ -668,23 +668,21 @@ void
client_set_name(struct client_ctx *cc)
{
struct winname *wn;
+ char *newname;
int i = 0;
- free(cc->name);
- if (!xu_get_strprop(cc->win, ewmh[_NET_WM_NAME], &cc->name))
- if (!xu_get_strprop(cc->win, XA_WM_NAME, &cc->name))
- cc->name = xstrdup("");
+ if (!xu_get_strprop(cc->win, ewmh[_NET_WM_NAME], &newname))
+ if (!xu_get_strprop(cc->win, XA_WM_NAME, &newname))
+ newname = xstrdup("");
TAILQ_FOREACH(wn, &cc->nameq, entry) {
- if (strcmp(wn->name, cc->name) == 0) {
+ if (strcmp(wn->name, newname) == 0)
TAILQ_REMOVE(&cc->nameq, wn, entry);
- free(wn->name);
- free(wn);
- }
i++;
}
+ cc->name = newname;
wn = xmalloc(sizeof(*wn));
- wn->name = xstrdup(cc->name);
+ wn->name = xstrdup(newname);
TAILQ_INSERT_TAIL(&cc->nameq, wn, entry);
/* Garbage collection. */