Fix a number of resource leaks

Free memory returned from parse_mkvi_value()
Free memory returned from printGPSCoords()
Free memory allocated in added_list and removed_list
Free memory allocated when adding suffix to dive site name
Free memory allocated in cache_deco_state()
Free memory allocated in build_filename()
Free memory allocated in get_utf8()
Free memory allocated in alloc_dive()
Free memory allocated as cache but never used

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-21 20:24:07 -07:00
parent 004705e33e
commit f5726c3d18
8 changed files with 26 additions and 11 deletions

View file

@ -184,9 +184,10 @@ static void parse_dive_gps(char *line, struct membuffer *str, void *_dive)
} else {
if (dive_site_has_gps_location(ds) &&
(ds->latitude.udeg != latitude.udeg || ds->longitude.udeg != longitude.udeg)) {
const char *coords = printGPSCoords(latitude.udeg, longitude.udeg);
// we have a dive site that already has GPS coordinates
ds->notes = add_to_string(ds->notes, translate("gettextFromC", "multiple gps locations for this dive site; also %s\n"),
printGPSCoords(latitude.udeg, longitude.udeg));
ds->notes = add_to_string(ds->notes, translate("gettextFromC", "multiple gps locations for this dive site; also %s\n"), coords);
free((void *)coords);
}
ds->latitude = latitude;
ds->longitude = longitude;
@ -218,6 +219,7 @@ static void parse_dive_location(char *line, struct membuffer *str, void *_dive)
ds->notes = add_to_string(ds->notes, translate("gettextFromC", "additional name for site: %s\n"), name);
}
}
free(name);
}
static void parse_dive_divemaster(char *line, struct membuffer *str, void *_dive)