]> git.sur5r.net Git - i3/i3/commitdiff
Use FREE macro for freeing colors
authorTony Crisci <tony@dubstepdish.com>
Wed, 2 Jul 2014 03:17:02 +0000 (23:17 -0400)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 2 Jul 2014 17:01:59 +0000 (19:01 +0200)
This macro will set the colors to NULL which avoids a double free on
reload when colors that were unconfigured become configured.

fixes #1299

i3bar/src/config.c

index 1f0c2a8eb2b3ec2439d3e65f8548a0ce7fa6de71..809b1ab4cfbec09840f919f3ae0bf42ab2e1efac 100644 (file)
@@ -248,8 +248,7 @@ void parse_config_json(char *json) {
 void free_colors(struct xcb_color_strings_t *colors) {
 #define FREE_COLOR(x)        \
     do {                     \
-        if (colors->x)       \
-            free(colors->x); \
+        FREE(colors->x);     \
     } while (0)
     FREE_COLOR(bar_fg);
     FREE_COLOR(bar_bg);