diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2018-02-19 21:28:03 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-02-22 21:48:46 +0200 |
commit | f08e24d65bc0dbd7b5f274e9aa4d4af89edf4887 (patch) | |
tree | 2fcbbba0714fd1236efe611f735de434ce918cd9 /core/plannernotes.c | |
parent | 4b2f289e4f61fe8f9090bf9346382c13370fe2e4 (diff) | |
download | subsurface-f08e24d65bc0dbd7b5f274e9aa4d4af89edf4887.tar.gz |
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 <sfuchs@gmx.de>
Diffstat (limited to 'core/plannernotes.c')
-rw-r--r-- | core/plannernotes.c | 4 |
1 files changed, 1 insertions, 3 deletions
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</b> (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, "<div><b>%s (%s) %s %s</b><br>", |