From 424e7570942976e2e25c4366f267c940db15d38c Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 26 Dec 2017 15:09:01 -0800 Subject: Cleanup: avoid memory leak Coverity CID 208308 Signed-off-by: Dirk Hohndel --- core/plannernotes.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/plannernotes.c') diff --git a/core/plannernotes.c b/core/plannernotes.c index 1773705b4..a2d4efa19 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -95,19 +95,23 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d free((void *)temp); return; } else if (diveplan->surface_interval >= 48 * 60 *60) { + const char *current_date = get_current_date(); len += snprintf(buffer + len, sz_buffer - len, "
%s (%s) %s %s
", translate("gettextFromC", "Subsurface"), subsurface_canonical_version(), translate("gettextFromC", "dive plan created on"), - get_current_date()); + current_date); + free((void *)current_date); } else { + const char *current_date = get_current_date(); len += snprintf(buffer + len, sz_buffer - len, "
%s (%s) %s %d:%02d) %s %s
", translate("gettextFromC", "Subsurface"), subsurface_canonical_version(), translate("gettextFromC", "dive plan
(surface interval "), FRACTION(diveplan->surface_interval / 60, 60), translate("gettextFromC", "created on"), - get_current_date()); + current_date); + free((void *)current_date); } if (prefs.display_variations && decoMode() != RECREATIONAL) -- cgit v1.2.3-70-g09d2