From b6187f73aad09adb0b70af8d77f1af1a34a338f8 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 18 Aug 2018 13:45:13 +0200 Subject: [PATCH] Cleanup: fix memory leak on failed DLF import In the case of a failed dlf import, the memory of the read-in file was not freed. Signed-off-by: Berthold Stoeger --- core/file.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/file.c b/core/file.c index beb799c09..f350b5bc3 100644 --- a/core/file.c +++ b/core/file.c @@ -335,11 +335,9 @@ int parse_file(const char *filename) /* Divesoft Freedom */ if (fmt && (!strcasecmp(fmt + 1, "DLF"))) { - if (!parse_dlf_buffer(mem.buffer, mem.size)) { - free(mem.buffer); - return 0; - } - return -1; + ret = parse_dlf_buffer(mem.buffer, mem.size); + free(mem.buffer); + return ret; } /* DataTrak/Wlog */