From 1a46f5eb9bcee0f8b3fdee9fc6c4f1143b2663c0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 26 Dec 2017 14:22:52 -0800 Subject: Cleanup: avoid memory leak Coverity CID 208327 Signed-off-by: Dirk Hohndel --- core/liquivision.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core') diff --git a/core/liquivision.c b/core/liquivision.c index f0762409c..fadde50a3 100644 --- a/core/liquivision.c +++ b/core/liquivision.c @@ -427,6 +427,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int // End dive dive->downloaded = true; record_dive(dive); + dive = NULL; mark_divelist_changed(true); // Advance ptr for next dive @@ -434,6 +435,9 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int } // while //DEBUG save_dives("/tmp/test.xml"); + + // if we bailed out of the loop, the dive hasn't been recorded and dive hasn't been set to NULL + free(dive); } int try_to_open_liquivision(const char *filename, struct memblock *mem) -- cgit v1.2.3-70-g09d2