aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2018-06-01 07:43:34 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2018-08-25 10:15:33 +0200
commit0543df5f31318ec5e10ec89c1afc616afc71cd7d (patch)
treee8f2a6dfa0134e34dbe6ba69c07ea5fd3ca65566
parentb6cdc292552acb1864c7cf4e46775f398d88eae3 (diff)
downloadcalcurse-0543df5f31318ec5e10ec89c1afc616afc71cd7d.tar.gz
calcurse-0543df5f31318ec5e10ec89c1afc616afc71cd7d.zip
Fix memory leak in update_duration()
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rw-r--r--src/ui-day.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ui-day.c b/src/ui-day.c
index af2258e..9a118dc 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -161,10 +161,13 @@ static void update_duration(long *start, long *dur)
int ret, early = 0;
status_mesg(msg_time, "");
ret = updatestring(win[STA].p, &timestr, 0, 1);
- if (ret == GETSTRING_ESC)
+ if (ret == GETSTRING_ESC) {
+ mem_free(timestr);
return;
+ }
if (*(timestr + strlen(timestr) - 1) == '?') {
asprintf(&outstr, "%s %s", DATEFMT(conf.input_datefmt), "%H:%M");
+ mem_free(timestr);
timestr = date_sec2date_str(end, outstr);
asprintf(&outstr, msg_help_1, DATEFMT_DESC(conf.input_datefmt));
status_mesg(outstr, msg_help_2);