From 3095bf42141723ebbfacb047aaa90c5b1b433420 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Mon, 4 Sep 2017 09:17:14 +0200 Subject: 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 Signed-off-by: Lukas Fleischer --- src/ui-day.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui-day.c') diff --git a/src/ui-day.c b/src/ui-day.c index 9ec0bc8..1cc9eb0 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -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); -- cgit v1.2.3-54-g00ecf