aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2017-09-04 09:17:14 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2017-09-04 16:34:19 +0200
commit3095bf42141723ebbfacb047aaa90c5b1b433420 (patch)
tree56079ee0ba5e6f8ad4185aabd9faaebba738c480
parent2e584f03e6242887984c7b5e7cfe77935017e8f5 (diff)
downloadcalcurse-3095bf42141723ebbfacb047aaa90c5b1b433420.tar.gz
calcurse-3095bf42141723ebbfacb047aaa90c5b1b433420.zip
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>
-rw-r--r--src/ui-day.c1
1 files changed, 1 insertions, 0 deletions
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);