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
|
@ -534,6 +534,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
|
|||
snprintf(fl, 13, "ANS%d.TXT", assembling_mbuf ? filenr - 2 : filenr - 1);
|
||||
ans_path = build_filename(build_filename(path, "ANS"), fl);
|
||||
ans_file = subsurface_open(ans_path, O_RDONLY, 0666);
|
||||
free(ans_path);
|
||||
size = bytes_available(ans_file);
|
||||
if (size > 3) {
|
||||
char *buf;
|
||||
|
@ -564,6 +565,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
|
|||
snprintf(fl, 13, "ANS%d.TXT", filenr - 1);
|
||||
ans_path = build_filename(build_filename(path, "ANS"), fl);
|
||||
ans_file = subsurface_open(ans_path, O_RDONLY, 0666);
|
||||
free(ans_path);
|
||||
size = bytes_available(ans_file);
|
||||
if (size > 3) {
|
||||
int r;
|
||||
|
@ -578,12 +580,11 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
|
|||
buffer_add(&mbuf, &mbuf_size, buf);
|
||||
show_progress(buf, what);
|
||||
#if UEMIS_DEBUG & 8
|
||||
fprintf(debugfile, "::r %s \"%s\"\n", ans_path, buf);
|
||||
fprintf(debugfile, "::r %s \"%s\"\n", fl, buf);
|
||||
#endif
|
||||
}
|
||||
size -= 3;
|
||||
close(ans_file);
|
||||
free(ans_path);
|
||||
} else {
|
||||
ismulti = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue