diff options
-rw-r--r-- | core/divecomputer.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/divecomputer.c b/core/divecomputer.c index 289f9efa2..19d4a6fee 100644 --- a/core/divecomputer.c +++ b/core/divecomputer.c @@ -474,14 +474,13 @@ void remove_event_from_dc(struct divecomputer *dc, struct event *event) void add_extra_data(struct divecomputer *dc, const char *key, const char *value) { struct extra_data **ed = &dc->extra_data; - const char *newval = strdup(value); if (!strcasecmp(key, "Serial")) { dc->deviceid = calculate_string_hash(value); - dc->serial = newval; + dc->serial = strdup(value); } if (!strcmp(key, "FW Version")) { - dc->fw_version = newval; + dc->fw_version = strdup(value); } while (*ed) @@ -489,7 +488,7 @@ void add_extra_data(struct divecomputer *dc, const char *key, const char *value) *ed = malloc(sizeof(struct extra_data)); if (*ed) { (*ed)->key = strdup(key); - (*ed)->value = newval; + (*ed)->value = strdup(value); (*ed)->next = NULL; } } |