Add missing string initialization
When introducing the fmt_day_heading() function in commit d56cc7a (Make heading in appointments panel configurable, 2017-08-19), we forgot to initialize the dynamic string. This resulted in calling mem_free() with a garbage pointer, potentially resulting in a segmentation fault. Fix this by calling string_init() before using the string. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
2e584f03e6
commit
3095bf4214
@ -915,6 +915,7 @@ static char *fmt_day_heading(time_t date)
|
||||
struct string s;
|
||||
|
||||
localtime_r(&date, &tm);
|
||||
string_init(&s);
|
||||
string_printf(&s, "%s ", ui_calendar_get_pom(date));
|
||||
string_catftime(&s, conf.day_heading, &tm);
|
||||
return string_buf(&s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user