From f08e24d65bc0dbd7b5f274e9aa4d4af89edf4887 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Mon, 19 Feb 2018 21:28:03 +0100 Subject: Exit add_plan_to_notes() in plannernotes.c always via label finished Replace an early "return" in add_plan_to_notes() with a "goto finished;" This was the initial idea of doing it plus it fixes a potential memory leak (missing free for icdbuffer). Signed-off-by: Stefan Fuchs --- core/plannernotes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'core/plannernotes.c') diff --git a/core/plannernotes.c b/core/plannernotes.c index 7f301d732..9cae66c5b 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -134,9 +134,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d subsurface_canonical_version(), translate("gettextFromC", "dive plan (overlapping dives detected)")); dive->notes = strdup(buffer); - free((void *)buffer); - free((void *)temp); - return; + goto finished; } 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
", -- cgit v1.2.3-70-g09d2