From f0b2bda9f5b3c95c94248f47df3c56dbdd42604b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 1 Mar 2024 23:32:17 +0100 Subject: [PATCH] core: use std::string for dummy hash value in parser Signed-off-by: Berthold Stoeger --- core/parse-xml.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/parse-xml.cpp b/core/parse-xml.cpp index 0383a92a6..7da775ff7 100644 --- a/core/parse-xml.cpp +++ b/core/parse-xml.cpp @@ -1244,7 +1244,6 @@ static void gps_picture_location(const 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, struct parser_state *state) { - char *hash = NULL; cylinder_t *cyl = dive->cylinders.nr > 0 ? get_cylinder(dive, dive->cylinders.nr - 1) : NULL; weightsystem_t *ws = dive->weightsystems.nr > 0 ? &dive->weightsystems.weightsystems[dive->weightsystems.nr - 1] : NULL; @@ -1293,9 +1292,8 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str return; if (MATCH("gps.picture", gps_picture_location, &state->cur_picture)) return; - if (MATCH("hash.picture", utf8_string, &hash)) { + if (std::string hash; MATCH("hash.picture", utf8_string_std, &hash)) { /* Legacy -> ignore. */ - free(hash); return; } if (MATCH_STATE("cylinderstartpressure", pressure, &p)) {