Fix memory handling for taxonomy data

The way we freed things and cleared out the variables potentially left
dangling data behind and could end up calling free on garbage data,
leading to random crashes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-07-13 07:09:55 -07:00
parent 15de7f0b71
commit 3478943f2f
4 changed files with 10 additions and 11 deletions

View file

@ -1527,7 +1527,7 @@ static void dive_site_end(void)
if (verbose > 3)
printf("completed dive site uuid %x8 name {%s}\n", ds->uuid, ds->name);
}
free_taxonomy(cur_dive_site->taxonomy.category);
free_taxonomy(&cur_dive_site->taxonomy);
free(cur_dive_site);
cur_dive_site = NULL;
}