mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
004705e33e
commit
f5726c3d18
8 changed files with 26 additions and 11 deletions
8
file.c
8
file.c
|
|
@ -547,11 +547,12 @@ int parse_txt_file(const char *filename, const char *csv)
|
|||
struct divecomputer *dc;
|
||||
struct tm cur_tm;
|
||||
|
||||
if (sscanf(parse_mkvi_value(memtxt.buffer, "Dive started at"), "%d-%d-%d %d:%d:%d",
|
||||
&y, &m, &d, &hh, &mm, &ss) != 6) {
|
||||
value = parse_mkvi_value(memtxt.buffer, "Dive started at");
|
||||
if (sscanf(value, "%d-%d-%d %d:%d:%d", &y, &m, &d, &hh, &mm, &ss) != 6) {
|
||||
free(value);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(value);
|
||||
cur_tm.tm_year = y;
|
||||
cur_tm.tm_mon = m - 1;
|
||||
cur_tm.tm_mday = d;
|
||||
|
|
@ -622,6 +623,7 @@ int parse_txt_file(const char *filename, const char *csv)
|
|||
*/
|
||||
|
||||
if (readfile(csv, &memcsv) < 0) {
|
||||
free(dive);
|
||||
return report_error(translate("gettextFromC", "Poseidon import failed: unable to read '%s'"), csv);
|
||||
}
|
||||
lineptr = memcsv.buffer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue