diff options
author | LemonBoy <thatlemon@gmail.com> | 2017-11-03 16:37:04 +0100 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2017-11-03 16:37:04 +0100 |
commit | 66b2c9bc91a3b6e34ba59491c95747db75d21c6b (patch) | |
tree | 80e9d74503671ffd90d166760dda509bf5bf7eb8 /src | |
parent | 7e619ed990503faf45fc1ae1e28a3a6062dc7532 (diff) | |
download | irssi-66b2c9bc91a3b6e34ba59491c95747db75d21c6b.zip |
Keep a copy of the strings coming from the config
The "HILIGHT_REC" structure used to keep a pointer to the "servertag"
string, owned by the "CONFIG_NODE", causing a double-free.
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/hilight-text.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 62e6f0de..b9912457 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -106,6 +106,7 @@ static void hilight_destroy(HILIGHT_REC *rec) if (rec->channels != NULL) g_strfreev(rec->channels); g_free_not_null(rec->color); g_free_not_null(rec->act_color); + g_free_not_null(rec->servertag); g_free(rec->text); g_free(rec); } @@ -424,7 +425,7 @@ static void read_hilight_config(void) CONFIG_NODE *node; HILIGHT_REC *rec; GSList *tmp; - char *text, *color; + char *text, *color, *servertag; hilights_destroy_all(); @@ -467,7 +468,9 @@ static void read_hilight_config(void) rec->nickmask = config_node_get_bool(node, "mask", FALSE); rec->fullword = config_node_get_bool(node, "fullword", FALSE); rec->regexp = config_node_get_bool(node, "regexp", FALSE); - rec->servertag = config_node_get_str(node, "servertag", NULL); + servertag = config_node_get_str(node, "servertag", NULL); + rec->servertag = servertag == NULL || *servertag == '\0' ? NULL : + g_strdup(servertag); hilight_init_rec(rec); node = iconfig_node_section(node, "channels", -1); |