summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-26 14:52:21 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-26 15:57:44 -0800
commit169a55d6e8d933885c266b72901c9a3460e777e7 (patch)
treea4c702936c4f258072d320fcab3214da2a9a363f
parent2fed7a944165d30ab2cb192c7984e3dc4ef118d4 (diff)
downloadsubsurface-169a55d6e8d933885c266b72901c9a3460e777e7.tar.gz
Cleanup: avoid memory leak
Coverity CID 208314 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/parse-xml.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index 3da64dac3..3f8f16554 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -1950,7 +1950,9 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size)
cur_latitude.udeg = (int)((ptr[7] << 24) + (ptr[6] << 16) + (ptr[5] << 8) + (ptr[4] << 0));
cur_longitude.udeg = (int)((ptr[11] << 24) + (ptr[10] << 16) + (ptr[9] << 8) + (ptr[8] << 0));
cur_dive->dive_site_uuid = create_dive_site_with_gps(NULL, cur_latitude, cur_longitude, cur_dive->when);
- printf("gps: %s\n", printGPSCoords(cur_latitude.udeg, cur_longitude.udeg));
+ const char * coords = printGPSCoords(cur_latitude.udeg, cur_longitude.udeg);
+ printf("gps: %s\n", coords);
+ free((void *)coords);
break;
default:
break;