aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2013-01-01 14:26:29 +0000
committerokan2013-01-01 14:26:29 +0000
commit02cf83785c3faa95fdb497b23c7b7090a7002a2f (patch)
treebaaf9752d8659126b65cbf66ac49b4f0d4c18d56 /client.c
parent04e1c4d4ec08c96fbc13dfb72f061b1845f9b785 (diff)
downloadcwm-02cf83785c3faa95fdb497b23c7b7090a7002a2f.tar.gz
replace emptystring with strdup here as well so we know we are free'ing
a malloc'd variable everytime; from Tiago Cunha
Diffstat (limited to 'client.c')
-rw-r--r--client.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/client.c b/client.c
index 3e52b5c..2a03885 100644
--- a/client.c
+++ b/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.108 2013/01/01 14:19:56 okan Exp $
+ * $OpenBSD: client.c,v 1.109 2013/01/01 14:26:29 okan Exp $
*/
#include <sys/param.h>
@@ -41,7 +41,6 @@ static void client_gethints(struct client_ctx *);
static void client_freehints(struct client_ctx *);
static int client_inbound(struct client_ctx *, int, int);
-static char emptystring[] = "";
struct client_ctx *_curcc = NULL;
struct client_ctx *
@@ -166,8 +165,7 @@ client_delete(struct client_ctx *cc)
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
TAILQ_REMOVE(&cc->nameq, wn, entry);
- if (wn->name != emptystring)
- free(wn->name);
+ free(wn->name);
free(wn);
}
@@ -558,7 +556,7 @@ client_setname(struct client_ctx *cc)
if (!xu_getstrprop(cc->win, ewmh[_NET_WM_NAME].atom, &newname))
if (!xu_getstrprop(cc->win, XA_WM_NAME, &newname))
- newname = emptystring;
+ newname = xstrdup("");
TAILQ_FOREACH(wn, &cc->nameq, entry)
if (strcmp(wn->name, newname) == 0) {
@@ -581,8 +579,7 @@ match:
wn = TAILQ_FIRST(&cc->nameq);
assert(wn != NULL);
TAILQ_REMOVE(&cc->nameq, wn, entry);
- if (wn->name != emptystring)
- free(wn->name);
+ free(wn->name);
free(wn);
cc->nameqlen--;
}