From: David Hill Date: Tue, 10 Jul 2012 18:42:07 +0000 (-0400) Subject: better allocation X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=b78adefb6507ceb8d3918f99f806292615124395;hp=e4a5f559835b0afb4f6ddfe846786022366ba586;p=spectrwm.git better allocation --- diff --git a/spectrwm.c b/spectrwm.c index 6242368..7291eb1 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -3738,12 +3738,12 @@ get_win_name(xcb_window_t win) c = xcb_icccm_get_wm_name(conn, win); if (xcb_icccm_get_wm_name_reply(conn, c, &r, NULL)) { - name = malloc((r.name_len + 1) * sizeof(char *)); + name = malloc(1, r.name_len + 1); if (!name) { xcb_get_text_property_reply_wipe(&r); return (NULL); } - memcpy(name, r.name, r.name_len * sizeof(char *)); + memcpy(name, r.name, r.name_len); name[r.name_len] = '\0'; }