summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-27 17:14:43 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-27 17:14:43 -0800
commitecd8580de9fc290a407207487994d0a0cf1ab7c2 (patch)
treeeffe3571a4f9f56e3fd828a5d9744edd30fcd2e1 /core
parentd3118bedd4f091aedbd941b1040aea2173bd1fed (diff)
downloadsubsurface-ecd8580de9fc290a407207487994d0a0cf1ab7c2.tar.gz
Cleanup: avoid memory leak
Coverity CID 45121 Coverity CID 45163 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/datatrak.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/datatrak.c b/core/datatrak.c
index cb2222765..4b9a28577 100644
--- a/core/datatrak.c
+++ b/core/datatrak.c
@@ -204,6 +204,7 @@ unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive)
if (dt_dive->dive_site_uuid == 0)
dt_dive->dive_site_uuid = create_dive_site(buffer, dt_dive->when);
free(locality);
+ locality = NULL;
free(dive_point);
/*
@@ -471,9 +472,9 @@ unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive)
dt_dive->notes = calloc((len +1), 1);
dt_dive->notes = memcpy(dt_dive->notes, buffer, len);
free(tmp_string1);
- if (tmp_notes_str != NULL)
- free(tmp_notes_str);
}
+ if (tmp_notes_str != NULL)
+ free(tmp_notes_str);
/*
* Alarms 1 and Alarms2 - Bit tables - Not in Subsurface, we use the profile
@@ -565,6 +566,7 @@ unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive)
free(devdata);
return membuf;
bail:
+ free(locality);
free(devdata);
return NULL;
}