diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-21 20:24:07 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-21 21:13:32 -0700 |
commit | f5726c3d184dce88822fd84dbe994d6fa92c089b (patch) | |
tree | ea5f96a9a81a4f07b3425bad134ed9a4959aa10f /libdivecomputer.c | |
parent | 004705e33e450c52d6753c55797885aedb6ad769 (diff) | |
download | subsurface-f5726c3d184dce88822fd84dbe994d6fa92c089b.tar.gz |
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>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index 6b7874d82..ef6e4f871 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -461,7 +461,10 @@ static dc_status_t libdc_header_parser(dc_parser_t *parser, struct device_data_t } // Parse the divetime. - dev_info(devdata, translate("gettextFromC", "Dive %d: %s"), import_dive_number, get_dive_date_c_string(dive->when)); + const char *date_string = get_dive_date_c_string(dive->when); + dev_info(devdata, translate("gettextFromC", "Dive %d: %s"), import_dive_number, date_string); + free((void *)date_string); + unsigned int divetime = 0; rc = dc_parser_get_field(parser, DC_FIELD_DIVETIME, 0, &divetime); if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) { |