summaryrefslogtreecommitdiffstats
path: root/core/liquivision.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-26 14:22:52 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-26 14:22:52 -0800
commit1a46f5eb9bcee0f8b3fdee9fc6c4f1143b2663c0 (patch)
treea34f7e205b6d66bd583d23dac75f19cadcf7ee3e /core/liquivision.c
parent42db44510d6e58120a9f0d272f5de2b26fb09ba7 (diff)
downloadsubsurface-1a46f5eb9bcee0f8b3fdee9fc6c4f1143b2663c0.tar.gz
Cleanup: avoid memory leak
Coverity CID 208327 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/liquivision.c')
-rw-r--r--core/liquivision.c4
1 files changed, 4 insertions, 0 deletions
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)