summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-17 20:35:08 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-10-21 19:56:02 +0300
commitbca9c8f88cccf708f54b97524dc84ab5aaa9c4f3 (patch)
treedb8580698156690cc501cf9cf41ea43692ced4e0
parent9025694d12a5f259c7cff13074bd7c67804abd65 (diff)
downloadsubsurface-bca9c8f88cccf708f54b97524dc84ab5aaa9c4f3.tar.gz
Parser: free city and country after use
The variables country and city used in divinglog_place() were never freed. Free them when the pointers are reset. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-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 ccc66f336..5a6474b20 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -970,6 +970,8 @@ static void divinglog_place(char *place, uint32_t *uuid)
*uuid = create_dive_site(buffer, cur_dive->when);
// TODO: capture the country / city info in the taxonomy instead
+ free(city);
+ free(country);
city = NULL;
country = NULL;
}
@@ -1201,7 +1203,7 @@ static void gps_picture_location(char *buffer, struct picture *pic)
/* We're in the top-level dive xml. Try to convert whatever value to a dive value */
static void try_to_fill_dive(struct dive *dive, const char *name, char *buf)
{
- char *hash;
+ char *hash = NULL;
start_match("dive", name, buf);
switch (import_source) {