summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-26 15:09:01 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-26 15:57:44 -0800
commit424e7570942976e2e25c4366f267c940db15d38c (patch)
treec31525468c91cd4fc2dde885f7ec2214558adb46 /core
parent169a55d6e8d933885c266b72901c9a3460e777e7 (diff)
downloadsubsurface-424e7570942976e2e25c4366f267c940db15d38c.tar.gz
Cleanup: avoid memory leak
Coverity CID 208308 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/plannernotes.c8
1 files changed, 6 insertions, 2 deletions
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, "<div><b>%s (%s) %s %s</b><br>",
translate("gettextFromC", "Subsurface"),
subsurface_canonical_version(),
translate("gettextFromC", "dive plan</b> 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, "<div><b>%s (%s) %s %d:%02d) %s %s<br>",
translate("gettextFromC", "Subsurface"),
subsurface_canonical_version(),
translate("gettextFromC", "dive plan</b> (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)