Cleanup: avoid memory leak

Coverity CID 208327

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-12-26 14:22:52 -08:00
parent 42db44510d
commit 1a46f5eb9b

View file

@ -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)